home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
351-375
/
disk_361
/
filemaster
/
source
/
source238
< prev
next >
Wrap
Text File
|
1992-05-06
|
160KB
|
8,481 lines
;
;
; FILE MASTER V1.2 (1st April 1990)
;
;
;
; COPYRIGHT BY : ROGER FISCHLIN
; STEIGERWALDWEG 6
; D-6450 HANAU 7
; WEST GERMANY
;
;
;
; Assembler : DevPac Assembler V2 by HiSoft
; Linker : BLINK by Software Distillery
;
;
;
; This file may be freely distributed as long as you don't gain any
; profit and this file must remain unchanged. FILE MASTER IS
; SHAREWARE !!!!!!!!!!
;
;
; some macros to save bytes (2 bytes)
CALLGRAF_PC macro
move.l _GfxBase(pc),a6
jsr _LVO\1(a6)
endm
CALLDOS_PC macro
move.l _DOSBase(pc),a6
jsr _LVO\1(a6)
endm
CALLINT_PC macro
move.l _IntuitionBase(pc),a6
jsr _LVO\1(a6)
endm
PrefSize equ (8*2)+2+2+6
; Section "Program",CODE_C
incdir "ram:include/","fh1:FileMaster/"
include intuition/intuition.i
include intuition/intuition_lib.i
include exec/memory.i
include exec/exec_lib.i
include exec/interrupts.i
include exec/IO.i
include exec/execbase.i
include hardware/intbits.i
include graphics/graphics_lib.i
include graphics/text.i
include libraries/dos_lib.i
include libraries/dos.i
include devices/inputevent.i
include math/mathFFP_lib.i
include workbench/startup.i
FontFlag set 0
SETAPEN macro
move.l WindowPointer,a1
move.l wd_RPort(a1),a1
moveq.l \1,d0
CALLGRAF_PC SetAPen
endm
SETBPEN macro
move.l WindowPointer,a1
move.l wd_RPort(a1),a1
moveq.l \1,d0
CALLGRAF_PC SetBPen
endm
SETDRMD macro
move.l WindowPointer,a1
move.l wd_RPort(a1),a1
moveq.l \1,d0
CALLGRAF_PC SetDrMd
endm
GOTOXY macro
move.l WindowPointer,a1
move.l wd_RPort(a1),a1
move.w \1,d0
move.w \2,d1
CALLGRAF_PC Move
endm
RECTFILL macro
move.l WindowPointer,a1
move.l wd_RPort(a1),a1
move.w \1,d0
move.w \2,d1
move.w \3,d2
move.w \4,d3
CALLGRAF_PC RectFill
endm
BORDER macro
bra.s MakeBox_\@
MakeBox2_\@ BOX \1,\2,\3,\4,\5,0
MakeBox_\@ move.l WindowPointer,a0
move.l wd_RPort(a0),a0
lea.l MakeBox2_\@(pc),a1
moveq.l #0,d0
moveq.l #0,d1
CALLINT_PC DrawBorder
endm
WRITE macro
move.l WindowPointer,a1
move.l wd_RPort(a1),a1
move.l a1,a3
move.w \1,d0
move.w \2,d1
CALLGRAF_PC Move
move.l a3,a1
moveq.l \3,d0
jsr _LVOSetAPen(a6)
lea.l .Write_Text\@(pc),a0
move.l a3,a1
move.l #.Write_Ende\@-.Write_Text\@,d0
jsr _LVOText(a6)
bra.s .Write_Label\@
.Write_Text\@ dc.b \4
.Write_Ende\@ dc.b 0
even
.Write_Label\@ nop
endm
WRITEMEM macro
move.l WindowPointer,a1
move.l wd_RPort(a1),a1
move.l a1,a3
move.w \1,d0
move.w \2,d1
CALLGRAF_PC Move
move.l a3,a1
moveq.l \3,d0
jsr _LVOSetAPen(a6)
lea.l \4,a0
move.l a3,a1
move.l \5,d0
jsr _LVOText(a6)
endm
BOX macro ; macro to create a border structure
dc.w 0,0
dc.b \5,0,RP_JAM1,5
dc.l box_\@,\6
box_\@ dc.w \1,\2,\3,\2,\3,\4,\1,\4,\1,\2
endm
TEXT macro ; macro to create a text structure
dc.b 2,0,RP_JAM1,0
dc.w \1+1,\2+1
dc.l TOPAZ_80,T_String\@,Text2_\@
Text2_\@ dc.b \3,0,RP_JAM1,0
dc.w \1,\2
dc.l TOPAZ_80,T_String\@,0
T_String\@ dc.b \4,0
even
IFEQ FontFlag
TOPAZ_80 dc.l T_80name
dc.w TOPAZ_EIGHTY
dc.b FS_NORMAL,FPF_ROMFONT
even
T_80name dc.b "topaz.font",0
FontFlag set 1
endc
endm
GTEXT macro ; macro to create a text structure
dc.b 1,4,RP_JAM2,0
dc.w \1,1
dc.l TOPAZ_80,.T_String\@,0
.T_String\@ dc.b \2,0
even
endm
GTEXT2 macro ; macro to create a text structure
dc.b $e,4,RP_JAM2,0
dc.w \1,1
dc.l TOPAZ_80,.T_String\@,0
.T_String\@ dc.b \2,0
even
endm
GTEXT3 macro ; macro to create a text structure
dc.b 7,4,RP_JAM2,0
dc.w \1,1
dc.l TOPAZ_80,.T_String\@,0
.T_String\@ dc.b \2,0
even
endm
TEXTR2 macro ; macro to create a text structure
dc.b \4,4,RP_JAM1,0
dc.w \1,\2
dc.l TOPAZ_80,\3,0
even
IFEQ FontFlag
TOPAZ_80 dc.l T_80name
dc.w TOPAZ_EIGHTY
dc.b FS_NORMAL,FPF_ROMFONT
even
T_80name dc.b "topaz.font",0
FontFlag set 1
endc
endm
StartUp jsr OpenThem ; get libraries
sub.l a1,a1
CALLEXEC FindTask
move.l d0,a4
tst.l pr_CLI(a4)
bne FromCLI
lea pr_MsgPort(a4),a0
CALLEXEC WaitPort
lea pr_MsgPort(a4),a0
CALLEXEC GetMsg
move.l d0,WB_Message
move.l d0,a0
move.l sm_ArgList(a0),a0
cmp.l #0,a0
beq.s Ende_Startup
move.l (a0),d1
CALLDOS CurrentDir
Ende_Startup jsr FileMaster ; main code
CALLEXEC Forbid
move.l WB_Message(pc),a1
CALLEXEC ReplyMsg
moveq.l #0,d0
rts
WB_Message dc.l 0
OpenThem lea dosname(pc),a1 ; open libs
CALLEXEC OldOpenLibrary
move.l d0,_DOSBase
lea intname(pc),a1
moveq.l #0,d0
CALLEXEC OpenLibrary
move.l d0,_IntuitionBase
lea grafname(pc),a1
CALLEXEC OldOpenLibrary
move.l d0,_GfxBase
rts
dosname DOSNAME
grafname GRAFNAME
intname INTNAME
FromCLI lea.l StartUp,a0
tst.l -(a0)
move.l (a0),d3
move.l d3,Segment
clr.l (a0)
move.l #TaskName,d1
moveq.l #0,d2
move.l #5000,d4
CALLDOS CreateProc
moveq.l #0,d0
rts
; MAIN PROGRAM
Section "PRG",CODE
FileMaster bsr.s Start
CALLEXEC Disable
move.l Segment,d1
CALLDOS UnLoadSeg
move.l _DOSBase(pc),a1
CALLEXEC CloseLibrary
move.l _GfxBase(pc),a1
CALLEXEC CloseLibrary
move.l _IntuitionBase(pc),a1
CALLEXEC CloseLibrary
moveq.l #0,d0
rts
Segment dc.l 0
OldWindow dc.l 0
Window1 dc.l 0
Window2 dc.l 0
TaskName dc.b "FileMaster.Task",0
even
FontFlag set 1
Start lea.l FONT_PAL1,a0 ; prepare FONTs
move.l a0,d0
add.l #$34,d0
move.l d0,tf_CharData(a0)
add.l #($96716-$9620e),d0
move.l d0,tf_CharLoc(a0)
lea.l FONT_NTSC1,a0
move.l a0,d0
add.l #$34,d0
move.l d0,tf_CharData(a0)
move.l tf_CharLoc(a0),d0
sub.l #$c4dff2,d0
add.l #FONT_NTSC1,d0
move.l d0,tf_CharLoc(a0)
jsr PAL_NTSC ; prepare for TV mode (PAL or NTSC)
clr.l Memory ; reset all
clr.l AnzahlBytes
clr.l Cursor
clr.l Size
clr.l Filehandle
clr.l AnzahlBytes
clr.b FlagFile
clr.b FlagWrite
clr.l SearchPos
clr.b CompPuffer
clr.l SearchLength
move.l #1,SearchMode
lea.l TOPAZ_80(pc),a0 ; opnen TOPAZ 80
CALLGRAF_PC OpenFont
move.l d0,FONT80
jsr GetPrefs ; get saved (?) preferences
jsr Hardcopy_Gadgets
lea.l M1_I6_String+12(pc),a0
move.b DriveName+2,(a0)
move.b Joker,JoString+12 ; copy joker to menu
lea.l Screendef(pc),a0 ; open screen
CALLINT_PC OpenScreen
tst.l d0
beq QUIT1
move.l d0,ScreenPtr1
lea.l Windowdef1(pc),a0 ; open window
CALLINT_PC OpenWindow
tst.l d0
beq QUIT2
move.l d0,Window1
move.l d0,a0 ; set colours
CALLINT_PC ViewPortAddress
move.l d0,a0
move.w #16,d0
lea.l Palette,a1
CALLGRAF_PC LoadRGB4
CALLINT_PC RemakeDisplay
sub.l a1,a1 ; DOS requester should appear in FileMaster's window
CALLEXEC FindTask
move.l d0,a0
move.l pr_WindowPtr(a0),OldWindow
move.l Window1(pc),pr_WindowPtr(a0)
move.b WriteMode,d0 ; set marks
bset.b #0,M1_I3_Sub1+mi_Flags
bset.b #0,M1_I3_Sub2+mi_Flags
bset.b #0,M1_I3_Sub3+mi_Flags
tst.b d0
beq.s .Q1
bclr.b #0,M1_I3_Sub1+mi_Flags
.Q1 cmp.b #1,d0
beq.s .Q2
bclr.b #0,M1_I3_Sub2+mi_Flags
.Q2 cmp.b #2,d0
beq.s .Q3
bclr.b #0,M1_I3_Sub3+mi_Flags
.Q3
move.l Window1(pc),a0 ; use menus
lea.l Menue1(pc),a1
CALLINT_PC SetMenuStrip
jsr OpenCon ; open console.device
tst.l d0
bne QUIT3
move.l ScreenPtr1(pc),a0
CALLINT_PC ScreenToFront
* create screen
moveq.w #0,d6 ; File name
move.w #11,d7
move.w #((32+1+7)*8)+8,d4
move.w #11+14,d5
bsr Areas
move.w #(32+1+7)*8+8,d6 ; Sector
move.w #11,d7
move.w #((32+2+7+16+2)*8)+12,d4
move.w #11+14,d5
bsr Areas
moveq.w #0,d6 ; Hex
move.w #11+14,d7
move.w #(32+1+7)*8+8,d4
move.w Screendef+ns_Height,d5
bsr Areas
move.w #(32+1+7)*8+8,d6 ; ASC
move.w #11+14,d7
move.w #(32+2+7+16+2)*8+12,d4
move.w Screendef+ns_Height,d5
bsr Areas
move.w #472+12,d6 ; ABOUT
move.w #11,d7
move.w #472+84+6,d4
move.w #11+29,d5
bsr Areas
move.w #472+84+6,d6 ; QUIT
move.w #11,d7
move.w #472+84+84,d4
move.w #11+29,d5
bsr Areas
move.w #472+12,d6 ; PROJECT
move.w #11+29,d7
move.w #472+168,d4
move.w #11+69,d5
bsr Areas
move.w #472+12,d6 ; Forward & Backward
move.w #11+69,d7
move.w #472+168,d4
move.w #11+89,d5
bsr Areas
move.w #472+12,d6 ; Write & Undo
move.w #11+89,d7
move.w #472+168,d4
move.w #11+109,d5
bsr Areas
move.w #472+12,d6 ; Search
move.w #11+109,d7
move.w #472+168,d4
move.w #11+149,d5
bsr Areas
move.w #472+12,d6 ; Cursor
move.w #11+149,d7
move.w #472+84+6,d4
move.w #11+179,d5
bsr Areas
move.w #472+84+6,d6 ; Mode
move.w #11+149,d7
move.w #472+84+84,d4
move.w #11+179,d5
bsr Areas
move.w #472+12,d6 ; Space
move.w #11+179,d7
move.w #472+168,d4
move.w Screendef+ns_Height,d5
bsr Areas
move.l Window1(pc),a1 ; redraw gadget
move.l wd_FirstGadget(a1),a0
sub.l a2,a2
CALLINT_PC RefreshGadgets
jsr PrintMode
jsr INFO
WindowPointer set Window1
NewFile clr.l Offset
tst.b FlagFile
bne .L1
moveq.w #0,d6 ; Clear Screen if no file was opened
move.w #11,d7
move.w #(32+1+7)*8+8,d4
move.w #11+14,d5
bsr Areas
move.w #(32+1+7)*8+8,d6 ; Sector
move.w #11,d7
move.w #(32+2+7+16+2)*8+12,d4
move.w #11+14,d5
bsr Areas
moveq.w #0,d6 ; Hex
move.w #11+14,d7
move.w #(32+1+7)*8+8,d4
move.w Screendef+ns_Height,d5
bsr Areas
move.w #(32+1+7)*8+8,d6 ; ASC
move.w #11+14,d7
move.w #(32+2+7+16+2)*8+12,d4
move.w Screendef+ns_Height,d5
bsr Areas
move.w #472+12,d6 ; Cursor
move.w #11+149,d7
move.w #472+84+6,d4
move.w #11+179,d5
bsr Areas
bra NewMode
.L1 move.l WindowPointer(pc),a1
move.l wd_RPort(a1),a1
move.l FONT80(pc),a0
CALLGRAF_PC SetFont
SETDRMD #RP_JAM2
SETBPEN #2
WRITEMEM #10,#11+3+6,#1,FileName,#37
tst.l Size
beq.s NewMode
moveq.l #0,d0
bra GetBlock
NewBlock bsr SectorNumber
tst.l AnzahlBytes
beq.s NewMode
bsr ShowPuffer
lea.l Color,a0
move.w #511,d0
.L1 move.b #3,(a0)+
dbra d0,.L1
move.l #1,Cursor
moveq.l #0,d0
bsr SetCursor
NewPos bsr PrintPosition
and.b #1,Mode ; if HEX mode -> 1.Nibble
NewMode bsr PrintMode
move.l WindowPointer(pc),a1 ; use TOPAZ 80
move.l wd_RPort(a1),a1
move.l FONT80(pc),a0
CALLGRAF_PC SetFont
SETDRMD #RP_JAM1
wait move.l Window1(pc),a0 ; wait .....
move.l wd_UserPort(a0),a0
move.l a0,a5
CALLEXEC WaitPort
move.l a5,a0
CALLEXEC GetMsg ; get message
move.l d0,a1
move.l im_Class(a1),d4 ; get data
move.w im_Code(a1),d5
move.w im_Qualifier(a1),d3
move.l im_IAddress(a1),a4
moveq.l #0,d6
moveq.l #0,d7
move.w im_MouseX(a1),d6
move.w im_MouseY(a1),d7
CALLEXEC ReplyMsg ; reply message
moveq.l #0,d0
move.b gg_GadgetID+1(a4),d0 ; get gadget ID
cmp.l #RAWKEY,d4
beq KeyPressed
cmp.l #GADGETUP,d4
beq GADGET
cmp.l #GADGETDOWN,d4
beq GADGET
cmp.l #MENUPICK,d4
beq.s MENU
Error move.l ScreenPtr1(pc),a0
CALLINT_PC DisplayBeep
bra wait
MENU cmp.w #MENUNULL,d5 ; check if an item was selected ?
beq wait
move.l d5,d0
and.l #$1f,d0
cmp.b #3,d0
beq GOTO_menu
cmp.b #2,d0
beq PROJECT_menu
cmp.b #1,d0
beq DISPLAY_menu
tst.b d0
bne wait
move.l d5,d0
lsr.l #5,d0
and.l #$1f,d0
lsl.l #2,d0
add.l #Menu0Table,d0
move.l d0,a0
move.l (a0),a0
move.l d5,d0 ; d0 contains sub item
lsr.l #8,d0
lsr.l #3,d0
and.l #$1f,d0
jmp (a0)
Menu0Table dc.l COLOUR,NewJoker,ChangeWrite,SavePrefs,DefaultPrefs,DRIVE
GOTO_menu move.l d5,d0 ; goto-menu
lsr.l #5,d0
and.l #$1f,d0
tst.b d0
beq.s .L1
cmp.b #1,d0
beq.s .L2
bra BLOCK
.L1 jmp FIRSTBLOCK
.L2 jmp LASTBLOCK
DISPLAY_menu move.l d5,d0 ; display-menu
lsr.l #5,d0
and.l #$1f,d0
jmp ChangeDisplay
PROJECT_menu move.l d5,d0 ; project-menu
lsr.l #5,d0
and.l #$1f,d0
tst.b d0
beq.s .W1
cmp.b #1,d0
beq.s .W2
cmp.b #2,d0
beq.s .W3
cmp.b #3,d0
beq.s .W4
cmp.b #4,d0
beq.s .W5
bra wait
.W1 jmp NEWSHELL
.W2 jmp MEMORY
.W3 jmp WORKBENCH
.W4 jmp PRINT
.W5 jmp CONVERTER
GADGET lsl.l #2,d0 ; get address from table
add.l #Vektoren,d0
move.l d0,a0
move.l (a0),a0
jmp (a0)
Vektoren dc.l OPEN,SAVE,SIZE,PREVIOUS,EXECUTE,FORWARD,BACKWARD,WRITE,UNDO,SEARCH
dc.l wait,ABOUT,QUIT,ChangeMode,HEX_Gadget,ASC_Gadget,BLOCK,NEXT,wait
QUIT bsr WriteQuestion
bsr SaveQuestion
bsr LEAVE ; ask
tst.l d0
bne wait
move.l Memory,a1 ; free memory if allocated
cmp.l #0,a1
beq .CloseFile
move.l Size,d0
CALLEXEC FreeMem
bra.s .L1
.CloseFile move.l Filehandle,d1 ; close file if opened
CALLDOS_PC Close
.L1 bsr CloseCon
move.l Window1(pc),a0
CALLINT_PC ClearMenuStrip
sub.l a1,a1
CALLEXEC FindTask
move.l d0,a0
move.l OldWindow(pc),pr_WindowPtr(a0)
move.l Window1(pc),a0 ; bye, bye !
CALLINT_PC CloseWindow
move.l ScreenPtr1(pc),a0
CALLINT_PC CloseScreen
NoDev moveq.l #0,d0
rts
TOPAZ_80 dc.l T_80name
dc.w TOPAZ_EIGHTY
dc.b FS_NORMAL,FPF_ROMFONT
even
T_80name dc.b "topaz.font",0
even
FONT80 dc.l 0
Screendef dc.w 0,0,640,256,3
dc.b 0,1
dc.w V_HIRES
dc.w CUSTOMSCREEN!SCREENBEHIND
dc.l TOPAZ_80
dc.l .S_Title,0,0
even
.S_Title dc.b "RF-Tools : File Master V1.2 © Roger Fischlin April/1990 ",0
even
Windowdef1 dc.w 0,0,640,256
dc.b 7,1
dc.l GADGETUP!RAWKEY!GADGETDOWN!MENUPICK
dc.l ACTIVATE!SMART_REFRESH!BACKDROP!SMART_REFRESH!BORDERLESS
dc.l W1_G1
dc.l 0
dc.l 0
ScreenPtr1 dc.l 0,0
dc.w 0,0,0,0,CUSTOMSCREEN
FM_GADGET macro
dc.l \1
dc.w \2,\3,\4,12
dc.w GADGHNONE!GADGIMAGE
dc.w RELVERIFY
dc.w BOOLGADGET
dc.l .Image,0
dc.l .Text
dc.l 0,0
dc.w \5
dc.l 0
.Text dc.b 0,0,RP_JAM1,0
dc.w (\4-((.S2-.S1-1)*8))/2,((12-8)/2)+1
dc.l TOPAZ_80,.S1,.Text2
.S1 dc.b \6,0
.S2
even
.Text2 dc.b \7,0,RP_JAM1,0
dc.w (\4-((.S2-.S1-1)*8))/2,(12-8)/2
dc.l TOPAZ_80,.S1,0
.Image dc.w 0,0,\4,12,3
dc.l 0
dc.b 0,0
dc.l .Image2
.Image2 dc.w 2,1,\4-4,12-2,3
dc.l 0
dc.b 0,\8
dc.l 0
endm
*
* Gadgets
*
W1_G1 FM_GADGET W1_G2,484+6,(11+29)+5,70,0,<"Open">,1,4
W1_G2 FM_GADGET W1_G3,484+6+3+72,(11+29)+5,70,1,<"Save As">,1,4
W1_G3 FM_GADGET W1_G4,484+6,(11+29)+5+14+4,70,2,<"Size">,1,4
W1_G4 FM_GADGET W1_G6,484+6+3+72,(11+29)+5+14+4,70,4,<"Execute">,1,4
W1_G6 FM_GADGET W1_G7,484+6,(11+69)+4,70,5,<"Forward">,1,7
W1_G7 FM_GADGET W1_G8,484+6+4+72,(11+69)+4,70,6,<"Backward">,1,7
W1_G8 FM_GADGET W1_G9,484+6,(11+89)+4,70,7,<"Write">,1,7
W1_G9 FM_GADGET W1_G10,484+6+3+72,(11+89)+4,70,8,<"Undo">,1,7
W1_G10 FM_GADGET W1_G11,484+6,(11+109)+5,72+3+70,9,<"Search">,1,7
W1_G11 FM_GADGET W1_G18,484+6,(11+109)+5+14+4,70,3,<"Previous">,1,7
W1_G18 FM_GADGET W1_G12,484+6+3+72,(11+109)+4+14+5,70,17,<"Next">,1,7
W1_G12 FM_GADGET W1_G13,484+9,(11+9),60,11,<"About">,1,4
W1_G13 FM_GADGET W1_G14,484+78+9,(11+9),60,12,<"Quit">,1,4
W1_G14 dc.l W1_G15 ; mode gadget
dc.w 472+84+6,11+149,84-6,30
dc.w GADGHNONE
dc.w GADGIMMEDIATE
dc.w BOOLGADGET
dc.l 0,0
dc.l 0
dc.l 0,0
dc.w 13
dc.l 0
W1_G15 dc.l W1_G16 ; HEX gadget
dc.w 0,11+14,8*(32+1+7)+8,256
dc.w GADGHNONE
dc.w GADGIMMEDIATE
dc.w BOOLGADGET
dc.l 0,0
dc.l 0
dc.l 0,0
dc.w 14
dc.l 0
W1_G16 dc.l W1_G17 ; ASC gadget
dc.w 8*(32+1+7)+8,11+14,8*(32+2+7+16+2-(32+1+7))+12,256
dc.w GADGHNONE
dc.w GADGIMMEDIATE
dc.w BOOLGADGET
dc.l 0,0
dc.l 0
dc.l 0,0
dc.w 15
dc.l 0
W1_G17 dc.l 0 ; sector gadget
dc.w 8*(32+1+7)+8,11,8*(32+2+7+16+2-(32+1+7)),+14
dc.w GADGHNONE
dc.w GADGIMMEDIATE
dc.w BOOLGADGET
dc.l 0,0
dc.l 0
dc.l 0,0
dc.w 16
dc.l 0
Menue1 dc.l Menue2
dc.w 10,0,15*8,10,MENUENABLED
dc.l .MenueName
dc.l M1_Item1,0,0
.MenueName dc.b "Preferences",0
even
M1_Item1 dc.l M1_Item2
dc.w 0,0,21*8,11,ITEMTEXT!COMMSEQ!HIGHCOMP!ITEMENABLED
dc.l 0,.Text,0
dc.b "p",0
dc.l 0,0
.Text dc.b 4,0,RP_JAM1,0
dc.w 4,2
dc.l 0,.String,0
.String dc.b "Palette",0
M1_Item2 dc.l M1_Item3
dc.w 0,11,21*8,11,ITEMTEXT!COMMSEQ!HIGHCOMP!ITEMENABLED
dc.l 0,.Text,0
dc.b "j",0
dc.l 0,0
.Text dc.b 4,0,RP_JAM1,0
dc.w 4,2
dc.l 0,JoString,0
JoString dc.b "Set joker : ?",0
M1_Item3 dc.l M1_Item4
dc.w 0,22,21*8,11,ITEMTEXT!HIGHCOMP!ITEMENABLED
dc.l 0,.Text,0
dc.b 0,0
dc.l M1_I3_Sub1,0
.Text dc.b 4,0,RP_JAM1,0
dc.w 4,2
dc.l 0,.String,0
.String dc.b "Write mode",0
M1_Item4 dc.l M1_Item5
dc.w 0,33,21*8,11,ITEMTEXT!HIGHCOMP!ITEMENABLED
dc.l 0,.Text,0
dc.b 0,0
dc.l M1_I4_Sub1,0
.Text dc.b 4,0,RP_JAM1,0
dc.w 4,2
dc.l 0,.String,0
.String dc.b "Save prefs",0
M1_Item5 dc.l M1_Item6
dc.w 0,44,21*8,11,ITEMTEXT!HIGHCOMP!ITEMENABLED!COMMSEQ
dc.l 0,.Text,0
dc.b "d",0
dc.l 0,0
.Text dc.b 4,0,RP_JAM1,0
dc.w 4,2
dc.l 0,.String,0
.String dc.b "Default prefs",0
M1_Item6 dc.l 0
dc.w 0,55,21*8,11,ITEMTEXT!HIGHCOMP!ITEMENABLED
dc.l 0,.Text,0
dc.b 0,0
dc.l 0,0
.Text dc.b 4,0,RP_JAM1,0
dc.w 4,2
dc.l 0,M1_I6_String,0
M1_I6_String dc.b "2nd drive df1:",0
M1_I3_Sub1 dc.l M1_I3_Sub2
dc.w 12*8,0,29*8,11,ITEMTEXT!COMMSEQ!HIGHCOMP!ITEMENABLED!CHECKIT
dc.l 0,.Text,0
dc.b "a",0
dc.l 0,0
.Text dc.b 4,0,RP_JAM1,0
dc.w 24,2
dc.l 0,.String,0
.String dc.b "Ask",0
M1_I3_Sub2 dc.l M1_I3_Sub3
dc.w 12*8,11,29*8,11,ITEMTEXT!COMMSEQ!HIGHCOMP!ITEMENABLED!CHECKIT
dc.l 0,.Text,0
dc.b "w",0
dc.l 0,0
.Text dc.b 4,0,RP_JAM1,0
dc.w 24,2
dc.l 0,.String,0
.String dc.b "Write without asking",0
M1_I3_Sub3 dc.l 0
dc.w 12*8,22,29*8,11,ITEMTEXT!HIGHCOMP!ITEMENABLED!COMMSEQ!CHECKIT
dc.l 0,.Text,0
dc.b "n",0
dc.l 0,0
.Text dc.b 4,0,RP_JAM1,0
dc.w 24,2
dc.l 0,.String,0
.String dc.b "Do not write",0
M1_I4_Sub1 dc.l M1_I4_Sub2
dc.w 12*8,0,20*8,11,ITEMTEXT!COMMSEQ!HIGHCOMP!ITEMENABLED
dc.l 0,.Text,0
dc.b "s",0
dc.l 0,0
.Text dc.b 4,0,RP_JAM1,0
dc.w 4,2
dc.l 0,.String,0
.String dc.b "to current dir",0
M1_I4_Sub2 dc.l 0
dc.w 12*8,11,20*8,11,ITEMTEXT!HIGHCOMP!ITEMENABLED
dc.l 0,.Text,0
dc.b "w",0
dc.l 0,0
.Text dc.b 4,0,RP_JAM1,0
dc.w 4,2
dc.l 0,.String,0
.String dc.b "to DEVS:",0
Menue2 dc.l Menue3
dc.w 160,0,10*8,10,MENUENABLED
dc.l .MenueName
dc.l M2_Item1,0,0
.MenueName dc.b "Display",0
even
M2_Item1 dc.l M2_Item2
dc.w 0,0,24*8,11,ITEMTEXT!COMMSEQ!HIGHCOMP!ITEMENABLED!CHECKIT!CHECKED
dc.l 2+4,.Text,0
dc.b "1",0
dc.l 0,0
.Text dc.b 4,0,RP_JAM1,0
dc.w 24,2
dc.l 0,.String,0
.String dc.b "all",0
M2_Item2 dc.l M2_Item3
dc.w 0,11,24*8,11,ITEMTEXT!COMMSEQ!HIGHCOMP!ITEMENABLED!CHECKIT
dc.l 1+4,.Text,0
dc.b "2",0
dc.l 0,0
.Text dc.b 4,0,RP_JAM1,0
dc.w 24,2
dc.l 0,.String,0
.String dc.b "only characters",0
M2_Item3 dc.l 0
dc.w 0,22,24*8,11,ITEMTEXT!COMMSEQ!HIGHCOMP!ITEMENABLED!CHECKIT
dc.l 1+2,.Text,0
dc.b "3",0
dc.l 0,0
.Text dc.b 4,0,RP_JAM1,0
dc.w 24,2
dc.l 0,.String,0
.String dc.b "only 32-125",0
Menue3 dc.l Menue4
dc.w 270,0,10*8,10,MENUENABLED
dc.l .MenueName
dc.l M3_Item1,0,0
.MenueName dc.b "Projects",0
even
M3_Item1 dc.l M3_Item2
dc.w 0,0,17*8,11,ITEMTEXT!COMMSEQ!HIGHCOMP!ITEMENABLED
dc.l 2+4,.Text,0
dc.b "i",0
dc.l 0,0
.Text dc.b 4,0,RP_JAM1,0
dc.w 4,2
dc.l 0,.String,0
.String dc.b "CLI/Shell",0
even
M3_Item2 dc.l M3_Item2b
dc.w 0,11,17*8,11,ITEMTEXT!COMMSEQ!HIGHCOMP!ITEMENABLED
dc.l 1+4,.Text,0
dc.b "m",0
dc.l 0,0
.Text dc.b 4,0,RP_JAM1,0
dc.w 4,2
dc.l 0,.String,0
.String dc.b "Memory",0
even
M3_Item2b dc.l M3_Item3
dc.w 0,22,17*8,11,ITEMTEXT!COMMSEQ!HIGHCOMP!ITEMENABLED
dc.l 1+4,.Text,0
dc.b "o",0
dc.l 0,0
.Text dc.b 4,0,RP_JAM1,0
dc.w 4,2
dc.l 0,.String,0
.String dc.b "Workbench",0
even
M3_Item3 dc.l M3_Item4
dc.w 0,33+6,17*8,11,ITEMTEXT!COMMSEQ!HIGHCOMP!ITEMENABLED
dc.l 1+2,.Text,0
dc.b "h",0
dc.l 0,0
.Text dc.b 4,0,RP_JAM1,0
dc.w 4,2
dc.l 0,.String,.Text2
.String dc.b "Hardcopy",0
even
.Text2 dc.b 2,0,RP_JAM1,0
dc.w 4,2-8
dc.l 0,.String2,0
.String2 dc.b "----------------",0
even
M3_Item4 dc.l M3_Item5
dc.w 0,44+6,17*8,11,ITEMTEXT!COMMSEQ!HIGHCOMP!ITEMENABLED
dc.l 1+2,.Text,0
dc.b "c",0
dc.l 0,0
.Text dc.b 4,0,RP_JAM1,0
dc.w 4,2
dc.l 0,.String,0
.String dc.b "Converter",0
even
M3_Item5 dc.l 0
dc.w 0,55+6,17*8,11,ITEMTEXT!COMMSEQ!HIGHCOMP
dc.l 1+2,.Text,0
dc.b "e",0
dc.l 0,0
.Text dc.b 4,0,RP_JAM1,0
dc.w 4,2
dc.l 0,.String,0
.String dc.b "Disassemble",0
even
Menue4 dc.l 0
dc.w 410,0,7*8,10,MENUENABLED
dc.l .MenueName
dc.l M4_Item1,0,0
.MenueName dc.b "Go to",0
even
M4_Item1 dc.l M4_Item2
dc.w 0,0,18*8,11,ITEMTEXT!COMMSEQ!HIGHCOMP!ITEMENABLED
dc.l 2+4,.Text,0
dc.b "f",0
dc.l 0,0
.Text dc.b 4,0,RP_JAM1,0
dc.w 4,2
dc.l 0,.String,0
.String dc.b "First sector",0
M4_Item2 dc.l M4_Item3
dc.w 0,11,18*8,11,ITEMTEXT!COMMSEQ!HIGHCOMP!ITEMENABLED
dc.l 1+4,.Text,0
dc.b "l",0
dc.l 0,0
.Text dc.b 4,0,RP_JAM1,0
dc.w 4,2
dc.l 0,.String,0
.String dc.b "Last sector",0
M4_Item3 dc.l 0
dc.w 0,22,18*8,11,ITEMTEXT!COMMSEQ!HIGHCOMP!ITEMENABLED
dc.l 1+4,.Text,0
dc.b "x",0
dc.l 0,0
.Text dc.b 4,0,RP_JAM1,0
dc.w 4,2
dc.l 0,.String,0
.String dc.b "sector",0
Cursor dc.l 0
Memory dc.l 0
Filehandle dc.l 0
Size dc.l 0
Offset dc.l 0
QUIT3 move.l Window1(pc),a0
CALLINT_PC ClearMenuStrip
move.l Window1(pc),a0
CALLINT_PC CloseWindow
QUIT2 move.l ScreenPtr1(pc),a0
CALLINT_PC CloseScreen
QUIT1 move.l #RECOVERY_ALERT,d0 ; error message
move.w #30,d1
lea.l ErrorText(pc),a0
CALLINT_PC DisplayAlert
moveq.l #0,d0
rts
ErrorText dc.w 60
dc.b 17
dc.b "File Master: ERROR !?! I cannot open the screen / window !"
dc.b 0,0
MK_Window dc.l 0
MakeWindow move.l ScreenPtr1(pc),nw_Screen(a0) ; open window
CALLINT_PC OpenWindow ; draw border and background
tst.l d0
beq QUIT1
move.l d0,-(sp)
move.l d0,a0
move.l d0,MK_Window
WindowPointer set MK_Window
move.w wd_Height(a0),d5
move.w wd_Width(a0),d4
subq #1,d5
subq #1,d4
move.l wd_RPort(a0),-(sp)
SETAPEN #7
move.w d4,d2
move.w d5,d3
subq.l #2,d2
subq.l #1,d3
moveq.l #1,d1
moveq.l #2,d0
move.l (sp),a1
CALLGRAF_PC RectFill
SETAPEN #0
moveq.l #0,d0 ; Top
moveq.l #0,d1
move.w d4,d2
moveq.l #0,d3
bsr .Line
moveq.l #0,d0 ; Bottom
move.l d5,d1
move.w d4,d2
move.l d5,d3
bsr .Line
moveq.l #0,d0 ; Left I
moveq.l #0,d1
moveq.l #0,d2
move.l d5,d3
bsr .Line
moveq.l #1,d0 ; Left II
moveq.l #0,d1
moveq.l #1,d2
move.l d5,d3
bsr .Line
move.l d4,d0 ; Right I
moveq.l #0,d1
move.l d4,d2
move.l d5,d3
bsr .Line
move.l d4,d0 ; Right II
moveq.l #0,d1
move.l d4,d2
move.l d5,d3
subq.l #1,d0
subq.l #1,d2
bsr .Line
move.l (sp)+,d0
move.l (sp),a1
move.l wd_FirstGadget(a1),a0
cmp.l #0,a0
beq .Label2
sub.l a2,a2
CALLINT_PC RefreshGadgets
.Label2 move.l (sp)+,d0
.exit rts
.Line move.l 4(sp),a1
CALLGRAF_PC Move
move.w d2,d0
move.w d3,d1
move.l 4(sp),a1
CALLGRAF_PC Draw
rts
Areas ; draw a area - used to create screen
WindowPointer set Window1
subq #1,d5
subq #1,d4
move.l Window1(pc),a0
move.l wd_RPort(a0),-(sp)
SETAPEN #7
move.w d4,d0
move.w d4,d2
move.w d7,d1
move.w d5,d3
subq #4,d0
move.l (sp),a1
CALLGRAF_PC RectFill
move.w d6,d0
move.w d5,d1
subq #4,d1
move.w d4,d2
move.w d5,d3
move.l (sp),a1
CALLGRAF_PC RectFill
SETAPEN #2
move.w d6,d0
addq.l #4,d0
move.w d7,d1
addq.l #2,d1
move.w d4,d2
subq #4,d2
move.w d5,d3
subq #2,d3
move.l (sp),a1
CALLGRAF_PC RectFill
SETAPEN #5
move.w d6,d0
move.w d7,d1
move.w d7,d3
move.w d4,d2
bsr .Line
move.w d6,d0
move.w d7,d1
move.w d7,d3
addq.l #1,d1
addq.l #1,d3
move.w d4,d2
subq #2,d2
bsr .Line
move.w d6,d0
move.w d7,d1
move.w d6,d2
move.w d5,d3
subq #1,d3
bsr .Line
move.w d6,d0
addq.l #1,d0
move.w d7,d1
move.w d6,d2
addq.l #1,d2
move.w d5,d3
subq #1,d3
bsr .Line
move.w d6,d0
addq #2,d0
move.w d7,d1
move.w d6,d2
addq #2,d2
move.w d5,d3
subq #2,d3
bsr .Line
move.w d6,d0
addq #3,d0
move.w d7,d1
move.w d6,d2
addq #3,d2
move.w d5,d3
subq #2,d3
bsr .Line
move.l (sp)+,d0
.exit rts
.Line move.l 4(sp),a1
CALLGRAF_PC Move
move.w d2,d0
move.w d3,d1
move.l 4(sp),a1
CALLGRAF_PC Draw
rts
OpenCon sub.l a1,a1 ; open console device
CALLEXEC FindTask ; it's used to convert RAWKEY
lea.l ReplyPort(pc),a1
move.l d0,$10(a1) ; into ASCII
CALLEXEC AddPort
moveq.l #0,d0
moveq.l #0,d1
lea.l ConName(pc),a0
lea.l ConIO(pc),a1
move.l Window1(pc),$28(a1)
move.l #48,$24(a1)
CALLEXEC OpenDevice
tst.l d0
bne.s CloseCon2
rts
ConIO ds.b 48
ReplyPort ds.l 8
ConName dc.b "console.device",0
even
CloseCon lea.l ConIO(pc),a1 ; close device
CALLEXEC CloseDevice
CloseCon2 lea.l ReplyPort(pc),a1
CALLEXEC RemPort
moveq.l #-1,d0
rts
KeyPressed cmp.b #CURSORLEFT,d5 ; cursor key ?
beq MoveCursorL
cmp.b #CURSORRIGHT,d5
beq MoveCursorR
cmp.b #CURSORUP,d5
beq MoveCursorU
cmp.b #CURSORDOWN,d5
beq MoveCursorD
btst #7,d5
beq wait
and.l #$7f,d5
move.l d3,d0
and.l #128+64,d0 ; skip if AMIGA-Key pressed
bne wait ; (because user only wanted to select a menu
; but he didn't want to enter a character)
cmp.b #$45,d5 ; ESC
beq .QUIT
cmp.b #$50,d5 ; F1
beq .OPEN
cmp.b #$51,d5 ; F2
beq .SAVE
cmp.b #$52,d5 ; F3
beq .EXECUTE
cmp.b #$53,d5 ; F4
beq .FORWARD
cmp.b #$54,d5 ; F5
beq .BACKWARD
cmp.b #$55,d5 ; F6
beq .WRITE
cmp.b #$56,d5 ; F7
beq .UNDO
cmp.b #$57,d5 ; F8
beq .SEARCH
cmp.b #$58,d5 ; F9
beq .PREVIOUS
cmp.b #$59,d5 ; F10
beq .NEXT
cmp.b #$5f,d5 ; Help
beq .KEY_INFO
cmp.b #$46,d5 ; DEL
beq .UNDO_CHAR
cmp.b #$f,d5 ; NK 0
bne KL1
bra.s ChangeMode
.QUIT jmp QUIT
.OPEN jmp OPEN
.SAVE jmp SAVE
.EXECUTE jmp EXECUTE
.FORWARD jmp FORWARD
.BACKWARD jmp BACKWARD
.WRITE jmp WRITE
.UNDO jmp UNDO
.SEARCH jmp SEARCH
.PREVIOUS jmp PREVIOUS
.NEXT jmp NEXT
.KEY_INFO jmp KEY_INFO
.UNDO_CHAR jmp UNDO_CHAR
ChangeMode eor.b #1,Mode ; change mode
and.b #1,Mode
bra NewMode
KL1 tst.l AnzahlBytes ; check, if there are bytes
beq wait
cmp.b #$41,d5
beq BackSpace
lea.l IE(pc),a0 ; put up INPUT EVENT structure
move.w d5,ie_Code(a0)
move.w d3,ie_Qualifier(a0)
move.b #IECLASS_RAWKEY,ie_Class(a0)
lea.l ASCII(pc),a1
moveq.l #4,d1
sub.l a2,a2
move.l ConIO+IO_DEVICE,a6 ; convert INPUT EVENT into ASCII
jsr -$30(a6)
cmp.b #1,d0
bne wait
tst.b Mode
bne HEX_Input
lea.l Puffer,a0
add.l Cursor(pc),a0
move.b ASCII,(a0)
lea.l Color,a0
add.l Cursor(pc),a0
move.b #1,(a0)
move.l Cursor(pc),d0
addq.l #1,d0
cmp.l AnzahlBytes,d0
bge.s .L2
bsr SetCursor
bra wait
.L2 move.l Cursor(pc),d0
bsr SetCursor
bra wait
even
IE ds.b ie_SIZEOF
even
ASCII ds.b 10
WindowPointer set Window1
ShowPuffer SETDRMD #RP_JAM2
SETAPEN #3
SETBPEN #2
bsr Set_Font
lea.l Puffer,a3
move.l a3,a4
add.l AnzahlBytes,a4
moveq.l #0,d5
.L1 lea.l .Line(pc),a0
move.w #99,d0
.L2 move.b #" ",(a0)+
dbra d0,.L2
lea.l .Line2(pc),a0
move.w #23,d0
.L3 move.b #" ",(a0)+
dbra d0,.L3
.L4 lea.l .Line(pc),a5
lea.l .Line2(pc),a6
move.l Bytes_Per_Row,d7
lsr.l #2,d7
subq.l #1,d7
.L5 moveq.l #3,d6
.L6 moveq.l #0,d4
move.b (a3)+,d4
lea.l HEX(pc),a0
cmp.l a4,a3
bhi .L7
tst.b DisplayMode ; replace nothing (show all ASCIIs)
beq .K1
cmp.b #1,DisplayMode ; replace 0-$1f and $80-$9f
bne .K2
move.b d4,d0
and.b #$7f,d0
cmp.b #$1f,d0
bhi .K1
.K4 move.b #".",(a6)+
bra.s .K3
.K2 cmp.b #$7d,d4 ; replace 0-$1f and $7e-$ff
bhi.s .K4
cmp.b #$1f,d4
bls.s .K4
.K1 move.b d4,(a6)+
.K3 move.l d4,d0
lsr.b #4,d0
and.l #$f,d4
move.b (a0,d0),(a5)+
move.b (a0,d4),(a5)+
bra.s .L8
.L7 move.b #" ",(a5)+
move.b #" ",(a5)+
move.b #" ",(a6)+
.L8 dbra d6,.L6
move.b #" ",(a5)+
dbra d7,.L5
move.l Window1(pc),a1
move.l wd_RPort(a1),a1
move.l HEX_X,d0
move.l d5,d1
mulu FONT_Y+2,d1
add.l HEX_Y,d1
CALLGRAF_PC Move
move.l Window1(pc),a1
move.l wd_RPort(a1),a1
lea.l .Line(pc),a0
move.l HEX_Breite,d0
CALLGRAF_PC Text
move.l Window1(pc),a1
move.l wd_RPort(a1),a1
move.l ASC_X,d0
move.l d5,d1
mulu FONT_Y+2,d1
add.l ASC_Y,d1
CALLGRAF_PC Move
move.l Window1,a1
move.l wd_RPort(a1),a1
lea.l .Line2(pc),a0
move.l ASC_Breite,d0
CALLGRAF_PC Text
addq.l #1,d5
cmp.l Zeilen,d5
bne .L1
rts
.Line ds.b 100
.Line2 ds.b 32
HEX dc.b "0123456789ABCDEF"
Set_Font move.l Window1(pc),a1
move.l wd_RPort(a1),a1
move.l FM_Font,a0
CALLGRAF_PC SetFont
rts
SetCursor tst.l AnzahlBytes
beq .NoFile
move.l d0,-(sp) ; d0=Pos
bsr.s Set_Font
cmp.l #-1,Cursor
beq .SetNew
lea.l Color,a0 ; clear old cursor position
moveq.l #0,d0
move.l Cursor(pc),d1
move.b (a0,d1),d0
move.l Window1(pc),a1
move.l wd_RPort(a1),a1
CALLGRAF_PC SetAPen
moveq.l #2,d0
move.l Window1(pc),a1
move.l wd_RPort(a1),a1
CALLGRAF_PC SetBPen
moveq.l #RP_JAM2,d0
move.l Window1(pc),a1
move.l wd_RPort(a1),a1
CALLGRAF_PC SetDrMd
move.l Cursor(pc),d0
bsr PutCursor
.SetNew lea.l Color,a0 ; pos new cursor
moveq.l #0,d0
move.l (sp),d1
move.b (a0,d1),d0
move.b d0,d5
move.l Window1(pc),a1
move.l wd_RPort(a1),a1
CALLGRAF_PC SetAPen
moveq.l #4,d0
cmp.b #1,d5
beq.s .L1
addq.l #2,d0
.L1 move.l Window1(pc),a1
move.l wd_RPort(a1),a1
CALLGRAF_PC SetBPen
moveq.l #RP_JAM2,d0
move.l Window1(pc),a1
move.l wd_RPort(a1),a1
CALLGRAF_PC SetDrMd
move.l (sp)+,d0
move.l d0,Cursor
bsr PutCursor
.NoFile rts
PutCursor move.l d0,d6
divu Bytes_Per_Row+2,d0
move.l d0,d1
lsr.l #8,d0
lsr.l #8,d0
move.l d0,d2
lsr.l #2,d2
lsl.l #1,d0
add.l d2,d0
mulu FONT_X+2,d0
add.l HEX_X,d0
and.l #$ff,d1
mulu FONT_Y+2,d1
add.l HEX_Y,d1
move.l Window1(pc),a1
move.l wd_RPort(a1),a1
CALLGRAF_PC Move
lea.l Puffer,a0
add.l d6,a0
moveq.l #0,d0
move.b (a0),d0
lea.l HEX(pc),a1
move.l d0,d4
lsr.b #4,d0
and.l #$f,d4
lea.l .HEX_Puffer(pc),a0
move.b (a1,d0),(a0)
move.b (a1,d4),1(a0)
moveq.l #2,d0
move.l Window1(pc),a1
move.l wd_RPort(a1),a1
CALLGRAF_PC Text
move.l d6,d0
divu Bytes_Per_Row+2,d0
move.l d0,d1
lsr.l #8,d0
lsr.l #8,d0
mulu FONT_X+2,d0
add.l ASC_X,d0
and.l #$ff,d1
mulu FONT_Y+2,d1
add.l ASC_Y,d1
move.l Window1(pc),a1
move.l wd_RPort(a1),a1
CALLGRAF_PC Move
lea.l Puffer,a0
add.l d6,a0
moveq.l #0,d0
move.b (a0),d0
tst.b DisplayMode ; replace nothing (show all ASCIIs)
beq .K1
cmp.b #1,DisplayMode ; replace 0-$1f and $80-$9f
bne .K2
move.b d0,d1
and.l #$7f,d1
cmp.b #$1f,d1
bhi .K1
.K4 move.b #".",d0
bra.s .K1
.K2 cmp.b #$7D,d0 ; replace 0-$1f and $7e-$ff
bhi.s .K4
cmp.b #$1f,d0
bls.s .K4
.K1 lea.l .HEX_Puffer(pc),a0
move.b d0,(a0)
moveq.l #1,d0
move.l Window1(pc),a1
move.l wd_RPort(a1),a1
CALLGRAF_PC Text
rts
.HEX_Puffer ds.b 2
*
* move cursor
*
MoveCursorL moveq.l #0,d1
move.w d3,d1
lsr.w #1,d1
or.w d3,d1
btst #0,d1
bne MoveCursorL_Shift
tst.l Cursor
beq.s .wait
move.l Cursor(pc),d0
subq.l #1,d0
bsr SetCursor
.wait bra NewPos
MoveCursorU moveq.l #0,d1
move.w d3,d1
lsr.w #1,d1
or.w d3,d1
btst #0,d1
bne MoveCursorU_Shift
move.l Cursor(pc),d0
sub.l ASC_Breite,d0
tst.l d0
bmi.s .wait
bsr SetCursor
.wait bra NewPos
MoveCursorR moveq.l #0,d1
move.w d3,d1
lsr.w #1,d1
or.w d3,d1
btst #0,d1
bne MoveCursorR_Shift
move.l Cursor(pc),d0
addq.l #1,d0
cmp.l AnzahlBytes,d0
beq.s .wait
bsr SetCursor
.wait bra NewPos
MoveCursorD moveq.l #0,d1
move.w d3,d1
lsr.w #1,d1
or.w d3,d1
btst #0,d1
bne MoveCursorD_Shift
move.l Cursor(pc),d0
add.l ASC_Breite,d0
cmp.l AnzahlBytes,d0
bge.s .wait
bsr SetCursor
.wait bra NewPos
MoveCursorL_Shift
move.l Cursor(pc),d0
subq.l #4,d0
and.l #-1-3,d0
tst.l d0
bpl.s .L1
moveq.l #0,d0
.L1 bsr SetCursor
bra NewPos
MoveCursorU_Shift
move.l Cursor(pc),d0
moveq.l #3,d1
.L1 sub.l ASC_Breite,d0
tst.l d0
bmi.s .L2
dbra d1,.L1
sub.l ASC_Breite,d0
.L2 add.l ASC_Breite,d0
bsr SetCursor
.wait bra NewPos
MoveCursorR_Shift
move.l Cursor(pc),d0
addq.l #4,d0
and.l #-1-3,d0
cmp.l AnzahlBytes,d0
bge.s .L1
bsr SetCursor
.wait bra NewPos
.L1 move.l AnzahlBytes,d0
subq.l #1,d0
bsr SetCursor
bra NewPos
MoveCursorD_Shift
move.l Cursor(pc),d0
moveq.l #3,d1
.L1 add.l ASC_Breite,d0
cmp.l AnzahlBytes,d0
bge.s .L2
dbra d1,.L1
add.l ASC_Breite,d0
.L2 sub.l ASC_Breite,d0
bsr SetCursor
.wait bra NewPos
File dc.l 0
OPEN bsr WriteQuestion
bsr SaveQuestion
lea.l Open_Text(pc),a5 ; OPEN A FILE
move.l #R_G1a,R_def+nw_FirstGadget
bsr FileRequester
tst.l d0
beq wait
move.l d0,File
moveq.w #0,d6 ; Clear Screen
move.w #11,d7
move.w #((32+1+7)*8)+8,d4
move.w #11+14,d5
bsr Areas
move.w #(32+1+7)*8+8,d6 ; Sector
move.w #11,d7
move.w #(32+2+7+16+2)*8+12,d4
move.w #11+14,d5
bsr Areas
moveq.w #0,d6 ; Hex
move.w #11+14,d7
move.w #(32+1+7)*8+8,d4
move.w Screendef+ns_Height,d5
bsr Areas
move.w #(32+1+7)*8+8,d6 ; ASC
move.w #11+14,d7
move.w #(32+2+7+16+2)*8+12,d4
move.w Screendef+ns_Height,d5
bsr Areas
move.w #484,d6 ; Cursor
move.w #11+149,d7
move.w #484+84-6,d4
move.w #11+179,d5
bsr Areas
move.l Memory(pc),a1 ; free memory if allocated
cmp.l #0,a1
beq .CloseFile
move.l Size(pc),d0
CALLEXEC FreeMem
bra.s .L1
.CloseFile move.l Filehandle(pc),d1 ; close file if opened
CALLDOS_PC Close
.L1 clr.l AnzahlBytes
clr.l Cursor
clr.l Size
clr.l Filehandle
clr.b FlagFile
clr.b FlagWrite
clr.l Memory
clr.l SearchSector
Q tst.b R_Gadget
beq .Open_File
move.l File(pc),d1 ; Copy file to RAM
move.l #MODE_OLDFILE,d2
CALLDOS_PC Open
tst.l d0
beq OpenError
move.l d0,Filehandle
move.l d0,d1 ; get file size
moveq.l #0,d2
moveq.l #OFFSET_END,d3
CALLDOS_PC Seek
tst.l d0
bmi DiskError
move.l Filehandle(pc),d1
moveq.l #0,d2
moveq.l #OFFSET_CURRENT,d3
CALLDOS_PC Seek
tst.l d0
bmi DiskError
move.l d0,.FileSize
move.l Filehandle(pc),d1
moveq.l #0,d2
moveq.l #OFFSET_BEGINNING,d3
CALLDOS_PC Seek
tst.l d0
bmi DiskError
tst.l .FileSize
beq .EmptyFile
moveq.l #MEMF_PUBLIC,d1
CALLEXEC AllocMem
tst.l d0
beq .NoMemory
move.l d0,Memory
move.l d0,d2
move.l Filehandle(pc),d1
move.l .FileSize(pc),d3
CALLDOS_PC Read
cmp.l d3,d0
bne .DiskError
move.l Filehandle(pc),d1
CALLDOS_PC Close
clr.l Filehandle
move.l .FileSize(pc),Size
.Z0 lea.l FileName(pc),a0 ; Copy file name
lea.l PrintHeader+9,a2
move.w #59,d0
.L0 move.b #" ",(a0)
move.b (a0)+,(a2)+
dbra d0,.L0
lea.l R_File(pc),a0
lea.l FileName(pc),a1
lea.l PrintHeader+9,a2
.L3 move.b (a0),(a1)+
move.b (a0)+,(a2)+
bne.s .L3
move.b #" ",-1(a1)
move.b #" ",-1(a2)
move.b #1,FlagFile
lea.l FileName+28(pc),a0 ; copy file size
move.l Size(pc),d0
move.b #"/",(a0)+
moveq.l #7,d2
moveq.l #0,d3
lea.l .Potenzen(pc),a2
.Z1 move.b #"0"-1,d1
.Z2 addq #1,d1
sub.l (a2),d0
bcc.s .Z2
add.l (a2)+,d0
tst.b d2
beq.s .Z3
cmp.b #"0",d1
beq.s .Z4
moveq.l #1,d3
bra.s .Z3
.Z4 tst.b d3
bne.s .Z3
move.b #" ",d1
.Z3 move.b d1,(a0)+
dbra d2,.Z1
bra NewFile
.Potenzen dc.l 10000000
dc.l 1000000
dc.l 100000
dc.l 10000
dc.l 1000
dc.l 100
dc.l 10
dc.l 1
.DiskError move.l .FileSize(pc),d0
move.l Memory(pc),a1
CALLEXEC FreeMem
clr.l Memory
bra DiskError
.NoMemory move.l Filehandle(pc),d1
CALLDOS_PC Close
clr.l Filehandle
bra NoMemory
.EmptyFile move.l Filehandle(pc),d1
CALLDOS_PC Close
clr.l Filehandle
bra EmptyFile
.FileSize dc.l 0
.Open_File move.l File(pc),d1 ; Open File
move.l #MODE_OLDFILE,d2
CALLDOS_PC Open
tst.l d0
beq OpenError
move.l d0,Filehandle
move.l d0,d1
moveq.l #0,d2
moveq.l #OFFSET_END,d3
CALLDOS_PC Seek
tst.l d0
bmi DiskError
move.l Filehandle(pc),d1
moveq.l #0,d2
moveq.l #OFFSET_CURRENT,d3
CALLDOS_PC Seek
tst.l d0
bmi DiskError
tst.l d0
beq EmptyFile
move.l d0,Size
bra .Z0
FileName dc.b " "
even
Open_Text dc.b " Open File: "
even
*
* Disk error
*
WindowPointer set Window2
Windowdef2 dc.w 60,50,300,70
dc.b -1,-1
dc.l GADGETUP
dc.l ACTIVATE!SMART_REFRESH!RMBTRAP
dc.l .Gadget1
dc.l 0
dc.l 0
dc.l 0,0
dc.w 0,0,0,0,CUSTOMSCREEN
.Gadget1 FM_GADGET 0,125,50,50,0,<"OK">,1,4
DiskError move.l Filehandle(pc),d1
CALLDOS_PC Close
clr.l Filehandle
OpenError move.l ScreenPtr1(pc),a0
CALLINT_PC DisplayBeep
lea.l Windowdef2(pc),a0
bsr MakeWindow
tst.l d0
beq .wait
move.l d0,Window2
SETDRMD #RP_JAM1
WRITE #6+(290-17*8)/2,#19,#0,<"»» DISK ERROR ««">
WRITE #5+(290-17*8)/2,#18,#1,<"»» DISK ERROR ««">
SETAPEN #0
move.l Window2(pc),a1
move.l wd_RPort(a1),a1
move.l a1,a3
moveq.l #6+((290-31*8)/2),d0
move.l #36,d1
CALLGRAF_PC Move
CALLDOS_PC IoErr
bsr .ErrorPointer
move.l a0,a5
move.l a3,a1
move.l #31,d0
CALLGRAF_PC Text
SETAPEN #1
move.l Window2(pc),a1
move.l wd_RPort(a1),a1
move.l a1,a3
moveq.l #5+((290-31*8)/2),d0
move.l #35,d1
CALLGRAF_PC Move
move.l a5,a0
move.l a3,a1
move.l #31,d0
CALLGRAF_PC Text
move.l Window2(pc),a0
move.l wd_UserPort(a0),a0
move.l a0,a5
CALLEXEC WaitPort
move.l Window2(pc),a0
CALLINT_PC CloseWindow
.wait bra wait
.ErrorPointer and.l #$ff,d0
tst.b d0
bne.s .Label1
add.b #232,d0
.Label1 sub.b #202,d0
mulu #31,d0
add.l #.Errors,d0
move.l d0,a0
rts
.Errors dc.b " Object in use "
dc.b " Object already exists "
dc.b " Directory not found "
dc.b " Object not found "
dc.b " Invalid window "
dc.b " ????? "
dc.b " ????? "
dc.b " Packet requested type unknown "
dc.b " Invalid stream component name "
dc.b " Invalid object lock "
dc.b " Object not of required type "
dc.b " Disk not validated "
dc.b " Disk write-protected "
dc.b "Rename across devices attemted "
dc.b " Directory not empty "
dc.b " ????? "
dc.b " Devices not mounted "
dc.b " Seek Error "
dc.b " Comment too big "
dc.b " Disk full "
dc.b "File is protected from deletion"
dc.b "File is protected from writing "
dc.b "File is protected from reading "
dc.b " Not a DOS disk "
dc.b " No Disk in Drive "
dc.b " No More entries in Directory "
dc.b " OK "
NoMemory move.l ScreenPtr1(pc),a0
CALLINT_PC DisplayBeep
lea.l Windowdef2(pc),a0
bsr MakeWindow
tst.l d0
beq .wait
move.l d0,Window2
SETDRMD #RP_JAM1
WRITE #6+(290-20*8)/2,#19+10,#0,<"Not enough memory !">
WRITE #5+(290-20*8)/2,#18+10,#1,<"Not enough memory !">
move.l Window2(pc),a0
move.l wd_UserPort(a0),a0
move.l a0,a5
CALLEXEC WaitPort
move.l Window2(pc),a0
CALLINT_PC CloseWindow
.wait bra wait
EmptyFile clr.l Filehandle
move.l ScreenPtr1(pc),a0
CALLINT_PC DisplayBeep
lea.l Windowdef2(pc),a0
bsr MakeWindow
tst.l d0
beq .wait
move.l d0,Window2
SETDRMD #RP_JAM1
WRITE #6+(290-16*8)/2,#19+10,#0,<"File is empty !">
WRITE #5+(290-16*8)/2,#18+10,#1,<"File is empty !">
move.l Window2(pc),a0
move.l wd_UserPort(a0),a0
move.l a0,a5
CALLEXEC WaitPort
move.l Window2(pc),a0
CALLINT_PC CloseWindow
.wait bra wait
*
* File Requester
*
include libraries/dosextens.i
TEXTR macro ; macro to create a text structure
dc.b \4,0,RP_JAM1,0
dc.w \1,\2
dc.l TOPAZ_80,\3,0
even
IFEQ FontFlag
TOPAZ_80 dc.l T_80name
dc.w TOPAZ_EIGHTY
dc.b FS_NORMAL,FPF_ROMFONT
even
T_80name dc.b "topaz.font",0
FontFlag set 1
endc
endm
R_def dc.w 60,6,296+72,189
dc.b 0,1
dc.l GADGETUP!GADGETDOWN
dc.l SMART_REFRESH!ACTIVATE!RMBTRAP
dc.l R_G1,0,0
R_S1 dc.l 0,0
dc.w 0,0,0,0,CUSTOMSCREEN
R_Window dc.l 0
R_G1a FM_GADGET R_G1b,10+(3*72),189-15,132,0,<"Edit On Device">,1,2
R_G1b FM_GADGET R_G2,10+72,189-15,132,-1,<"Edit In RAM">,1,2
R_G1c FM_GADGET R_G2,10+(3*72),189-15,132,0,<"ProPatch">,1,2
;R_G1d FM_GADGET R_G2,10+72,189-15,132,-1,<"FM-Patch">,1,2 ; someday perhaps ...
R_G1 FM_GADGET R_G2,296-70+72,189-15,60,0,<"OK">,1,2
R_G2 FM_GADGET R_G3,10,189-15,60,1,<"Cancel">,1,2
R_G3 FM_GADGET R_G4,10,189-35,60,2,<"DF0:">,1,4
R_G4 dc.l R_G5
dc.w 10+72,189-35,60,12
dc.w GADGHNONE!GADGIMAGE
dc.w RELVERIFY
dc.w BOOLGADGET
dc.l .Image,0
dc.l .Text
dc.l 0,0
dc.w 3
dc.l 0
.Text dc.b 0,0,RP_JAM1,0
dc.w (60-32)/2,((12-8)/2)+1
dc.l TOPAZ_80,DriveName,.Text2
even
.Text2 dc.b 1,0,RP_JAM1,0
dc.w (60-32)/2,(12-8)/2
dc.l TOPAZ_80,DriveName,0
.Image dc.w 0,0,60,12,3
dc.l 0
dc.b 0,0
dc.l .Image2
.Image2 dc.w 2,1,60-4,12-2,3
dc.l 0
dc.b 0,4
dc.l 0
R_G5 FM_GADGET R_G6,10+(2*72),189-35,60,4,<"RAM:">,1,4
R_G6 FM_GADGET R_G30,10+(3*72),189-35,60,5,<"Parent">,1,4
R_G30 FM_GADGET R_G7,10+(4*72),189-35,60,30,<"Devs">,1,4
R_G7 dc.l R_G8
dc.w 70,-55,216+72,10,GADGHCOMP!GRELBOTTOM,RELVERIFY,STRGADGET
dc.l R_G7_Box,0,R_G7_Text,0,R_G7_Info
dc.w 0,0,0
R_G7_Box BOX -60,-2,216+72,9,1,R_G7_Box2
R_G7_Box2 BOX -60,-2,-4,9,1,R_G7_Box3
R_G7_Box3 BOX -3,-1,215+72,8,0,R_G7_Box4
R_G7_Box4 BOX -2,-1,-1,8,0,0
R_G7_Text TEXTR -60+2,0,R_G7_string,1
R_G7_string dc.b "file ",0
R_G7_Info dc.l R_File,R_File_Undo
dc.w 0,43
ds.w 12
R_File ds.b 44
R_File_Undo ds.b 44
R_G8 dc.l R_G9
dc.w 70,18,216+72,10,GADGHCOMP,RELVERIFY,STRGADGET
dc.l R_G7_Box,0,R_G8_Text,0,R_G8_Info
dc.w 7,0,0
R_G8_Text TEXTR -60+2,0,R_G8_string,1
R_G8_string dc.b "Drawer",0
R_G8_Info dc.l R_Drawer,R_Drawer_Undo
dc.w 0,100
ds.w 12
R_Drawer dc.b ":",0
ds.b 302
R_Drawer_Undo ds.b 302
R_G9 dc.l R_G10
dc.w 11,51-16,15,9,GADGHNONE!GADGIMAGE,RELVERIFY!GADGIMMEDIATE,BOOLGADGET
dc.l R_G9_PfeilUp,0,0,0,0
dc.w 8,0,0
R_G10 dc.l R_G11
dc.w 11,51-16+63+18,15,9,GADGHNONE!GADGIMAGE,RELVERIFY!GADGIMMEDIATE,BOOLGADGET
dc.l R_G10_PfeilD,0,0,0,0
dc.w 9,0,0
R_G11 dc.l R_G12
dc.w 11,61-16,15,52+18,GADGHNONE!GADGIMAGE,RELVERIFY!GADGIMMEDIATE,PROPGADGET
dc.l R_G11_mover,0,0,0,R_G11_Info
dc.w 10,0,0
R_G11_mover ds.w 6
R_G11_Info dc.w AUTOKNOB!PROPBORDERLESS!FREEVERT
dc.w 0,0,0,$ffff
ds.w 7
R_G12 dc.l R_G13
dc.w 27,51-16+(0*9),259+72,9,GADGHCOMP,RELVERIFY,BOOLGADGET
dc.l 0,0,0,0,0
dc.w 11,0,0
R_G13 dc.l R_G14
dc.w 27,51-16+(1*9),259+72,9,GADGHCOMP,RELVERIFY,BOOLGADGET
dc.l 0,0,0,0,0
dc.w 12,0,0
R_G14 dc.l R_G15
dc.w 27,51-16+(2*9),259+72,9,GADGHCOMP,RELVERIFY,BOOLGADGET
dc.l 0,0,0,0,0
dc.w 13,0,0
R_G15 dc.l R_G16
dc.w 27,51-16+(3*9),259+72,9,GADGHCOMP,RELVERIFY,BOOLGADGET
dc.l 0,0,0,0,0
dc.w 14,0,0
R_G16 dc.l R_G17
dc.w 27,51-16+(4*9),259+72,9,GADGHCOMP,RELVERIFY,BOOLGADGET
dc.l 0,0,0,0,0
dc.w 15,0,0
R_G17 dc.l R_G18
dc.w 27,51-16+(5*9),259+72,9,GADGHCOMP,RELVERIFY,BOOLGADGET
dc.l 0,0,0,0,0
dc.w 16,0,0
R_G18 dc.l R_G19
dc.w 27,51-16+(6*9),259+72,9,GADGHCOMP,RELVERIFY,BOOLGADGET
dc.l 0,0,0,0,0
dc.w 17,0,0
R_G19 dc.l R_G20
dc.w 27,51-16+(7*9),259+72,9,GADGHCOMP,RELVERIFY,BOOLGADGET
dc.l 0,0,0,0,0
dc.w 18,0,0
R_G20 dc.l R_G21
dc.w 27,51-16+(8*9),259+72,9,GADGHCOMP,RELVERIFY,BOOLGADGET
dc.l 0,0,0,0,0
dc.w 19,0,0
R_G21 dc.l 0
dc.w 27,51-16+(9*9),259+72,9,GADGHCOMP,RELVERIFY,BOOLGADGET
dc.l 0,0,0,0,0
dc.w 20,0,0
R_G22
R_FileBox BOX 0,0,276+72,73+18,6,R_FileBox2
R_FileBox2 BOX 0,0,16,73+18,6,R_FileBox3
R_FileBox3 BOX 0,10,16,63+18,6,0
R_maxEntries equ 300
FileRequester cmp.l #R_G1,R_def+nw_FirstGadget
beq.s R_1
clr.w R_G7+gg_Activation
R_1 lea.l R_def(pc),a0
bsr MakeWindow
tst.l d0
beq Rexit
move.l d0,R_Window
move.l d0,a1
move.l wd_RPort(a1),a1
moveq.l #0,d0
CALLGRAF_PC SetAPen
move.l R_Window(pc),a1
move.l wd_RPort(a1),a1
move.w #10+17,d0
move.w #51-16,d1
move.w #11+273+1+72,d2
move.w #49+73+2,d3
CALLGRAF_PC RectFill
move.l R_Window(pc),a1
move.l wd_RPort(a1),a1
move.l a1,a2
moveq.l #RP_JAM1,d0
CALLGRAF_PC SetDrMd
move.l a2,a1
move.w #11,d1
move.w #(296+72-320)/2,d0
CALLGRAF_PC Move
move.l a2,a1
moveq.l #0,d0
CALLGRAF_PC SetAPen
move.l a5,a0
move.l a2,a1
move.l #40,d0
CALLGRAF_PC Text
move.l a2,a1
move.w #10,d1
move.w #(296+72-320)/2,d0
CALLGRAF_PC Move
move.l a2,a1
moveq.l #1,d0
CALLGRAF_PC SetAPen
move.l a5,a0
move.l a2,a1
move.l #40,d0
CALLGRAF_PC Text
move.l a2,a1
moveq.l #RP_JAM2,d0
CALLGRAF_PC SetDrMd
move.l R_Window(pc),a1
sub.l a2,a2
lea.l R_G17(pc),a0
CALLINT_PC RefreshGadgets
move.l R_Window(pc),a0
move.l wd_RPort(a0),a0
lea.l R_FileBox(pc),a1
moveq.l #10,d0
move.w #50-16,d1
CALLINT_PC DrawBorder
move.l #-1,R_Selected
tst.l R_Read
beq R_Label30
R_NewDrawer clr.l R_Anzahl
clr.l R_Position
move.l #-1,R_Selected
bsr R_RemakeGadget
bsr R_RemakeProp
move.l R_Window(pc),a1
move.l wd_RPort(a1),a1
moveq.l #0,d0
CALLGRAF_PC SetAPen
move.l R_Window(pc),a1
move.l wd_RPort(a1),a1
move.w #10+17,d0
move.w #51-16,d1
move.w #11+273+72,d2
move.w #49+73+2,d3
CALLGRAF_PC RectFill
move.l #R_Drawer,d1
moveq.l #-2,d2
CALLDOS_PC Lock
move.l d0,R_Lock
tst.l d0
beq R_Error
move.l R_Lock(pc),d1
move.l #R_FIB,d2
CALLDOS_PC Examine
tst.l d0
beq R_freeLock
move.l R_Lock(pc),d1
move.l #R_FIB,d2
CALLDOS_PC ExNext
tst.l d0
beq R_freeLock
R_Label14 lea.l R_FIB(pc),a0
move.l R_Anzahl(pc),d0
mulu #38,d0
add.l R_Namen(pc),d0
move.l d0,a1
move.l fib_DirEntryType(a0),d0
and.l #1,d0
move.b d0,(a1)+
move.w #31,d0
lea.l fib_FileName(a0),a0
R_Label20 move.b (a0)+,(a1)+
dbra d0,R_Label20
clr.b (a1)+
move.l fib_Size+R_FIB,(a1)+
addq.l #1,R_Anzahl
bsr R_RemakeProp
move.l #1,R_Read
move.l R_Window(pc),a0
move.l wd_UserPort(a0),a0
CALLEXEC GetMsg
tst.l d0
beq R_Label40
move.l d0,a1
moveq.l #0,d2
moveq.l #0,d3
move.l im_Class(a1),d4
move.w im_Code(a1),d5
move.l im_IAddress(a1),a4
CALLEXEC ReplyMsg
moveq.l #0,d0
move.b gg_GadgetID+1(a4),d0
cmp.b #30,d0
beq.s R_Label41a
tst.b d0
bmi.s R_Label41a
cmp.b #7,d0
bhi R_Label40
R_Label41a move.l d0,d6
move.l R_Lock(pc),d1
CALLDOS_PC UnLock
move.l d6,d0
bra R_Label41
R_Label40 cmp.l #R_maxEntries,R_Anzahl
beq R_Label40a
move.l R_Lock(pc),d1
move.l #R_FIB,d2
CALLDOS_PC ExNext
tst.l d0
R_Label40a bne R_Label14
clr.l R_Read
R_freeLock move.l R_Lock(pc),d1
CALLDOS_PC UnLock
R_V3 bsr R_SORT
R_Label30 bsr R_RemakeGadget
bsr R_RemakeProp
bsr R_FilePrint
move.l R_def+nw_FirstGadget(pc),a0
move.l R_Window(pc),a1
sub.l a2,a2
CALLINT_PC RefreshGadgets
R_wait move.l R_Window(pc),a0
move.l wd_UserPort(a0),a0
move.l a0,a4
CALLEXEC WaitPort
move.l a4,a0
CALLEXEC GetMsg
tst.l d0
beq.s R_wait
move.l d0,a1
moveq.l #0,d2
moveq.l #0,d3
move.l im_Class(a1),d4
move.w im_Code(a1),d5
move.l im_IAddress(a1),a4
CALLEXEC ReplyMsg
moveq.l #0,d0
move.b gg_GadgetID+1(a4),d0
R_Label41 cmp.b #10,d0
beq R_PROP
cmp.b #8,d0
beq R_UP
cmp.b #9,d0
beq R_DOWN
cmp.b #2,d0
beq R_DF0
cmp.b #3,d0
beq R_DF1
cmp.b #30,d0
beq R_DEVICES
cmp.b #4,d0
beq R_RAM
cmp.b #7,d0
beq R_NewDrawer
cmp.b #5,d0
beq R_Parent
cmp.b #10,d0
bgt R_Select
cmp.b #1,d0
beq RcloseWindow
move.b d0,R_Gadget
R_OK lea.l R_Drawer(pc),a0
lea.l R_FileName(pc),a1
R_Label120 move.b (a0)+,(a1)+
bne.s R_Label120
tst.b -(a1)
cmp.b #":",-1(a1)
beq.s R_Label122
move.b #"/",(a1)+
R_Label122 lea.l R_File(pc),a0
R_Label121 move.b (a0)+,(a1)+
bne.s R_Label121
move.l R_Window(pc),A0
CALLINT_PC CloseWindow
move.l #R_FileName,d0
rts
;
; prop gadget
;
R_PROP cmp.l #GADGETUP,d4
beq.s .UpDown
bsr R_ChangePos
move.l R_Window(pc),a0
move.l wd_UserPort(a0),a0
CALLEXEC GetMsg
tst.l d0
beq.s R_PROP
move.l d0,a1
CALLEXEC ReplyMsg
.UpDown bsr R_ChangePos
bra R_wait
RcloseWindow move.l R_Window(pc),A0
CALLINT_PC CloseWindow
Rexit moveq.l #0,d0
rts
dc.b "::"
R_FileName ds.b 400
R_Namen dc.l NamenPuffer
R_Lock dc.l 0
R_Anzahl dc.l 0
R_Position dc.l 0
R_Selected dc.l 0
R_Read dc.l 1
R_Puffer ds.b 48*11
R_Gadget dc.b 0
cnop 0,4
R_FIB ds.b $104
R_SORT cmp.l #1,R_Anzahl
bls R_SORT_Label0
movem.l d1-d7/a0-a2,-(sp)
move.l a0,a2
move.l R_Anzahl(pc),d5
subq.l #1,d5
R_SORT_Label1 moveq.l #0,d7
moveq.l #0,d6
R_SORT_Label2 move.l d6,d0
move.l d0,d1
addq.l #1,d1
bsr R_COMPARE
bls.s R_SORT_Label3
move.l d6,d0
move.l d0,d1
addq.l #1,d1
moveq.l #1,d7
bsr R_SWAP
R_SORT_Label3 addq #1,d6
cmp.l d6,d5
bhi R_SORT_Label2
subq #1,d5
tst.b d7
bne R_SORT_Label1
movem.l (sp)+,d1-d7/a0-a2
R_SORT_Label0 rts
R_COMPARE mulu #38,d0
mulu #38,d1
add.l R_Namen(pc),d0
add.l R_Namen(pc),d1
move.l d0,a0
move.l d1,a1
move.w #38,d2
subq.l #1,d2
R_SORT_Label6 move.b (a1)+,d0
jsr UPCASE
move.b d0,d1
move.b (a0)+,d0
jsr UPCASE
R_SORT_Label8 cmp.b d1,d0
bne.s R_SORT_Label5
dbra d2,R_SORT_Label6
R_SORT_Label5 rts
R_SWAP mulu #38,d0
mulu #38,d1
add.l R_Namen(pc),d0
add.l R_Namen(pc),d1
move.l d0,a0
move.l d1,a1
move.w #38,d0
subq.l #1,d0
R_SORT_Label9 move.b (a0),d1
move.b (a1),(a0)+
move.b d1,(a1)+
dbra d0,R_SORT_Label9
rts
R_DF0 move.l #"df0:",R_Drawer
clr.b R_Drawer+4
lea.l R_G8(pc),a0
move.l R_Window(pc),a1
sub.l a2,a2
CALLINT_PC RefreshGadgets
bra R_NewDrawer
R_DF1 move.l DriveName,R_Drawer
clr.b R_Drawer+4
lea.l R_G8(pc),a0
move.l R_Window(pc),a1
sub.l a2,a2
CALLINT_PC RefreshGadgets
bra R_NewDrawer
R_RAM move.l #"ram:",R_Drawer
clr.b R_Drawer+4
lea.l R_G8(pc),a0
move.l R_Window(pc),a1
sub.l a2,a2
CALLINT_PC RefreshGadgets
bra R_NewDrawer
R_Parent lea.l R_Drawer(pc),a0
move.l a0,a1
R_Label60 tst.b (a0)+
bne.s R_Label60
tst.b -(a0)
tst.b -(a0)
R_Label61 cmp.l a0,a1
beq.s R_Label62
move.b -(a0),d0
cmp.b #":",d0
beq.s R_Label63
cmp.b #"/",d0
bne.s R_Label61
tst.b -(a0)
R_Label63 clr.b 1(a0)
lea.l R_G8(pc),a0
move.l R_Window(pc),a1
sub.l a2,a2
CALLINT_PC RefreshGadgets
bra R_NewDrawer
R_Label62 bra R_wait
R_Text dc.b "Drawer doesn't exist !",0
R_Error bsr R_RemakeGadget
bsr R_RemakeProp
bsr R_FilePrint
move.l R_Window(pc),a1
move.l wd_RPort(a1),a1
move.l a1,a2
move.l #58+(3*9),d1
move.l #68+(72/2),d0
CALLGRAF_PC Move
move.l a2,a1
moveq.l #6,d0
CALLGRAF_PC SetAPen
lea.l R_Text(pc),a3
move.l a3,a0
move.l a2,a1
moveq.l #-1,d0
R_Label100 addq.l #1,d0
tst.b (a3)+
bne.s R_Label100
CALLGRAF_PC Text
bra R_wait
R_Select sub.b #11,d0
and.l #$f,d0
add.l R_Position(pc),d0
move.l d0,d7
mulu #38,d0
add.l R_Namen(pc),d0
move.l d0,a0
move.b (a0)+,d0
beq R_Dir
cmp.b #2,d0
beq R_DEV
lea.l R_File(pc),a1
move.w #31,d0
R_Label70 move.b (a0)+,(a1)+
beq.s R_Label71
dbra d0,R_Label70
R_Label71 lea.l R_G7(pc),a0
move.l R_Window(pc),a1
sub.l a2,a2
CALLINT_PC RefreshGadgets
cmp.l #R_G1,R_def+nw_FirstGadget
bne R_wait
cmp.l R_Selected(pc),d7
beq R_OK
move.l d7,R_Selected
bra R_wait
R_Dir lea.l R_Drawer(pc),a1
R_Label72 tst.b (a1)+
bne.s R_Label72
tst.b -(a1)
cmp.b #":",-1(a1)
beq R_Label75
move.b #"/",(a1)+
R_Label75 move.w #31,d0
R_Label73 move.b (a0)+,(a1)+
beq.s R_Label74
dbra d0,R_Label73
R_Label74 lea.l R_G7(pc),a0
move.l R_Window(pc),a1
sub.l a2,a2
CALLINT_PC RefreshGadgets
bra R_NewDrawer
R_DEV lea.l R_Drawer(pc),a1
move.w #31,d0
R_Label200 move.b (a0)+,(a1)+
beq.s R_Label201
dbra d0,R_Label200
R_Label201 lea.l R_G7(pc),a0
move.l R_Window(pc),a1
sub.l a2,a2
CALLINT_PC RefreshGadgets
bra R_NewDrawer
R_Colors dc.b 1,6,2
even
R_FilePrint move.l #48*11-1,d0
lea.l R_Puffer(pc),a0
R_Label1 move.b #" ",(a0)+
dbra d0,R_Label1
move.l R_Position(pc),d0
move.l d0,d6
moveq.l #0,d5
mulu #38,d0
add.l R_Namen(pc),d0
move.l d0,a0
R_Label2 move.l d5,d0
mulu #48,d0
add.l #R_Puffer,d0
move.l d0,a1
cmp.l R_Anzahl(pc),d6
beq R_Label6
move.b (a0)+,(a1)+
moveq.l #0,d1
move.l #31,d4
R_Label3 move.b (a0)+,d0
tst.b d1
bne.s R_Label3a
tst.b d0
bne.s R_Label4
moveq.l #1,d1
R_Label3a move.b #" ",d0
R_Label4 move.b d0,(a1)+
dbra d4,R_Label3
lea.l 1(a1),a1
lea.l 1(a0),a0
move.l (a0)+,d0
bsr R_PrintSize
addq.l #1,d6
addq.l #1,d5
cmp.b #10,d5
bne R_Label2
R_Label6 lea.l R_Puffer(pc),a3
moveq.l #0,d5
R_Label5 move.l R_Window(pc),a1
move.l wd_RPort(a1),a1
move.l a1,a2
move.l #28,d0
move.l d5,d1
mulu #9,d1
add.l #58-16,d1
CALLGRAF_PC Move
move.l a2,a1
lea.l R_Colors(pc),a0
and.l #$f,d0
move.b (a3)+,d0
move.b (a0,d0),d0
CALLGRAF_PC SetAPen
move.l a2,a1
move.l a3,a0
move.l #41,d0
CALLGRAF_PC Text
add.l #47,a3
addq #1,d5
cmp.b #10,d5
bne R_Label5
rts
R_PrintSize movem.l d0-d7/a0-a5,-(sp)
move.b -38(a0),d2
tst.b d2
beq R_PS_Dir
cmp.b #2,d2
beq R_PS_Dev
moveq.l #7,d2
moveq.l #0,d3
lea.l R_Potenzen(pc),a2
R_PS1 move.b #"0"-1,d1
R_PS2 addq #1,d1
sub.l (a2),d0
bcc R_PS2
add.l (a2)+,d0
tst.b d2
beq R_PS3
cmp.b #"0",d1
beq R_PS4
moveq.l #1,d3
bra R_PS3
R_PS4 tst.b d3
bne R_PS3
move.b #" ",d1
R_PS3 move.b d1,(a1)+
dbra d2,R_PS1
movem.l (sp)+,d0-d7/a0-a5
rts
R_Potenzen dc.l 10000000
dc.l 1000000
dc.l 100000
dc.l 10000
dc.l 1000
dc.l 100
dc.l 10
dc.l 1
R_PS_Dir_Text dc.b " « Dir »"
R_PS_Dev_Text dc.b " « Dev »"
R_PS_Dir lea.l R_PS_Dir_Text(pc),a2
moveq.l #7,d0
R_PS_Dir2 move.b (a2)+,(a1)+
dbra d0,R_PS_Dir2
movem.l (sp)+,d0-d7/a0-a5
rts
R_PS_Dev lea.l R_PS_Dev_Text(pc),a2
moveq.l #7,d0
R_PS_Dev2 move.b (a2)+,(a1)+
dbra d0,R_PS_Dev2
movem.l (sp)+,d0-d7/a0-a5
rts
R_UP tst.l R_Position
beq R_wait
bmi R_wait
sub.l #1,R_Position
bsr R_FilePrint
bsr R_RemakeProp
move.l R_Window(pc),a0
move.l wd_UserPort(a0),a0
CALLEXEC GetMsg
tst.l d0
beq R_UP
move.l d0,a1
CALLEXEC ReplyMsg
bra R_wait
R_DOWN move.l R_Position(pc),d0
add.l #10,d0
cmp.l R_Anzahl(pc),d0
bge R_wait
add.l #1,R_Position
bsr R_FilePrint
bsr R_RemakeProp
move.l R_Window(pc),a0
move.l wd_UserPort(a0),a0
CALLEXEC GetMsg
tst.l d0
beq R_DOWN
move.l d0,a1
CALLEXEC ReplyMsg
bra R_wait
R_RemakeProp lea.l R_G11(pc),a0
move.l R_Window(pc),a1
sub.l a2,a2
move.l #AUTOKNOB!PROPBORDERLESS!FREEVERT,d0
moveq.l #0,d1
moveq.l #0,d3
move.l R_Anzahl(pc),d2
sub.l #10,d2
tst.w d2
beq.s R_Label10x
bpl.s R_Label10
R_Label10x moveq.l #1,d2
R_Label10 move.l #$ffff,d4
divu d2,d4
and.l #$ffff,d4
move.l R_Position,d2
R_Label11 mulu d4,d2
CALLINT_PC ModifyProp
rts
R_ChangePos cmp.l #10,R_Anzahl
bls R_Label12
lea.l R_G11_Info(pc),a0
moveq.l #0,d0
move.w pi_VertPot(a0),d0
divu pi_VertBody(a0),d0
and.l #$ffff,d0
cmp.l R_Position,d0
beq R_Label12
move.l d0,R_Position
bsr R_FilePrint
R_Label12 rts
R_RemakeGadget lea.l R_G12(pc),a0
move.l R_Anzahl,d0
cmp.l #10,d0
bls R_Label50
moveq.l #10,d0
R_Label50 tst.l d0
beq R_Label51
move.w #GADGHCOMP,gg_Flags(a0)
move.w #RELVERIFY,gg_Activation(a0)
lea.l gg_SIZEOF(a0),a0
subq.l #1,d0
bra.s R_Label50
R_Label51 cmp.l #R_G22,a0
beq R_Label52
move.w #GADGHNONE,gg_Flags(a0)
clr.w gg_Activation(a0)
lea.l gg_SIZEOF(a0),a0
bra.s R_Label51
R_Label52 rts
R_DEVICES clr.l R_Anzahl
clr.l R_Position
move.l #-1,R_Selected
bsr R_RemakeGadget
bsr R_RemakeProp
move.l R_Window,a1
move.l wd_RPort(a1),a1
moveq.l #0,d0
CALLGRAF_PC SetAPen
move.l R_Window,a1
move.l wd_RPort(a1),a1
move.w #10+17,d0
move.w #51-16,d1
move.w #11+273+1+72,d2
move.w #49+75,d3
CALLGRAF_PC RectFill
move.l _DOSBase,a2
move.l dl_Root(a2),a2
move.l rn_Info(a2),a2
add.l a2,a2
add.l a2,a2
move.l di_DevInfo(a2),a2
add.l a2,a2
add.l a2,a2
R_V1 cmp.l #DLT_DEVICE,dl_Type(a2)
bne R_V2
tst.l dl_Task(a2)
beq R_V2
move.l R_Anzahl,d0
mulu #38,d0
add.l R_Namen,d0
move.l d0,a1
move.b #2,(a1)+
move.l a1,a3
moveq.l #0,d0
move.l dl_Name(a2),a0
add.l a0,a0
add.l a0,a0
move.b (a0)+,d0
subq #1,d0
R_V20 move.b (a0)+,(a1)+
dbra d0,R_V20
move.b #":",(a1)+
clr.b (a1)
R_V23 addq.l #1,R_Anzahl
R_V2 move.l (a2),a2
add.l a2,a2
add.l a2,a2
cmp.l #0,a2
bne R_V1
bra R_V3
even
WindowPointer set Window1
PrintMode SETDRMD #RP_JAM2 ; write mode (0=HEX, 1=ASC)
SETBPEN #2
move.l WindowPointer,a1
move.l wd_RPort(a1),a1
move.l FONT80(pc),a0
CALLGRAF_PC SetFont
move.b Mode,d0
tst.b d0
beq PM1
WRITE #(484+78+((78-3*8)/2)),#11+149+15-4+6,#0,<"HEX">
rts
PM1 WRITE #(484+78+((78-3*8)/2)),#11+149+15-4+6,#0,<"ASC">
rts
PS_Text dc.b "$.../..."
even
PrintPosition SETDRMD #RP_JAM2 ; write cursor position
SETBPEN #2
move.l WindowPointer(pc),a1
move.l wd_RPort(a1),a1
move.l FONT80(pc),a0
CALLGRAF_PC SetFont
move.l Cursor(pc),d0
lea.l PS_Text+1(pc),a5
lea.l HEX(pc),a4
lsr.l #8,d0
move.b (a4,d0),(a5)+
move.l Cursor(pc),d0
lsr.l #4,d0
and.l #$f,d0
move.b (a4,d0),(a5)+
move.l Cursor(pc),d0
and.l #$f,d0
move.b (a4,d0),(a5)+
move.l Cursor(pc),d0
lea.l 1(a5),a5
moveq.l #2,d2
moveq.l #0,d3
lea.l PS_Potenzen(pc),a2
.PS1 move.b #"0"-1,d1
.PS2 addq #1,d1
sub.l (a2),d0
bcc.s .PS2
add.l (a2)+,d0
tst.b d2
beq.s .PS3
cmp.b #"0",d1
beq.s .PS4
moveq.l #1,d3
bra.s .PS3
.PS4 tst.b d3
bne.s .PS3
move.b #" ",d1
.PS3 move.b d1,(a5)+
dbra d2,.PS1
WRITEMEM #484+((78-8*8)/2),#11+149+15-4+6,#0,PS_Text,#8
rts
PS_Potenzen dc.l 100
dc.l 10
dc.l 1
ASC_Gadget sub.l ASC_X,d6 ; user clicked ASC gadget
sub.l ASC_Y,d7
add.l BaseLine,d7
tst.l d6
bmi.s .wait
tst.l d7
bmi.s .wait
divu FONT_X+2,d6
and.l #$ff,d6
cmp.l Bytes_Per_Row,d6
bge.s .wait
divu FONT_Y+2,d7
and.l #$ff,d7
mulu ASC_Breite+2,d7
add.l d6,d7
cmp.l AnzahlBytes,d7
bge.s .wait
move.l d7,d0
bsr SetCursor
clr.b Mode
bsr PrintPosition
bra NewMode
.wait bra wait
HEX_Gadget sub.l HEX_X,d6 ; user clicked HEX gadget
sub.l HEX_Y,d7
add.l BaseLine,d7
and.l #$ffff,d7
divu FONT_Y+2,d7
and.l #$ffff,d7
mulu Bytes_Per_Row+2,d7
divu FONT_X+2,d6
and.l #$ffff,d6
divu #9,d6
move.l d6,d5
and.l #$ffff,d6
lsl.w #2,d6
swap d5
and.l #$ffff,d5
cmp.b #8,d5
beq.s .wait
lsr.l #1,d5
add.l d5,d6
add.l d6,d7
cmp.l AnzahlBytes,d7
bge.s .wait
move.l d7,d0
bsr SetCursor
move.b #1,Mode
bsr PrintPosition
bra NewMode
.wait bra wait
HEX_Input moveq.l #0,d0
move.b ASCII(pc),d0
lea.l .Hex(pc),a0 ; convert ASCII (d0) to nibble (d1)
moveq.l #-1,d1
.L1 addq.l #1,d1
cmp.b #32,d1
bhi .Error
cmp.b (a0)+,d0
bne.s .L1
and.l #$f,d1 ; don't care about A or a
cmp.b #1,Mode ; fist nibble ?
beq.s .L2
or.b Nibble,d1
lea.l Puffer,a0
add.l Cursor(pc),a0
move.b d1,(a0)
lea.l Color,a0
add.l Cursor(pc),a0
move.b #1,(a0)
move.b #1,Mode
move.l Cursor(pc),d0
addq.l #1,d0
cmp.l AnzahlBytes,d0
bge.s .L3
bsr SetCursor
bra wait
.L3 move.l Cursor(pc),d0
bsr SetCursor
bra wait
.L2 lea.l .Hex+16(pc),a0
move.b (a0,d1),.ASCII
lsl.b #4,d1
move.b d1,Nibble
move.b #3,Mode
bsr Set_Font ; write first nibble
lea.l Color,a0
move.l Cursor(pc),d1
move.b (a0,d1),d1
moveq.l #4,d0
moveq.l #6,d4
cmp.b #1,d1
beq.s .L5
addq.l #2,d0
subq.l #2,d4
.L5 move.l Window1(pc),a1
move.l wd_RPort(a1),a1
CALLGRAF_PC SetBPen
move.l d4,d0
move.l Window1(pc),a1
move.l wd_RPort(a1),a1
CALLGRAF_PC SetAPen
moveq.l #RP_JAM2,d0
move.l Window1(pc),a1
move.l wd_RPort(a1),a1
CALLGRAF_PC SetDrMd
move.l Cursor(pc),d0
divu Bytes_Per_Row+2,d0
move.l d0,d1
lsr.l #8,d0
lsr.l #8,d0
move.l d0,d2
lsr.l #2,d2
lsl.l #1,d0
add.l d2,d0
mulu FONT_X+2,d0
add.l HEX_X,d0
and.l #$ff,d1
mulu FONT_Y+2,d1
add.l HEX_Y,d1
move.l Window1(pc),a1
move.l wd_RPort(a1),a1
CALLGRAF_PC Move
moveq.l #1,d0
move.l Window1(pc),a1
move.l wd_RPort(a1),a1
lea.l .ASCII(pc),a0
CALLGRAF_PC Text
bra wait
.Hex dc.b "0123456789abcdef"
dc.b "0123456789ABCDEF"
.ASCII dc.b 0
even
.Error bra Error
BackSpace cmp.b #3,Mode
bne .UNDO_CHAR_BACK ; delete last byte
move.l Cursor(pc),d0 ; delete last nibble
bsr SetCursor
move.b #1,Mode
bra wait
.UNDO_CHAR_BACK
jmp UNDO_CHAR_BACK
GetBlock move.l d0,.Offset
tst.l Memory ; get block offset d0
beq.s .GetBlockDisk
move.l Memory(pc),a0
add.l d0,a0
lea.l Puffer,a1
lea.l UndoPuffer,a2
move.l #511,d0
.L0 move.b (a0),(a1)+
move.b (a0)+,(a2)+
dbra d0,.L0
move.l Size(pc),d0
sub.l .Offset(pc),d0
cmp.l #512,d0
bls.s .L3
move.l #512,d0
.L3 move.l d0,AnzahlBytes
move.l .Offset(pc),Offset
bra NewBlock
.GetBlockDisk move.l Filehandle(pc),d1
tst.l d1
beq .Error
move.l .Offset(pc),d2
moveq.l #OFFSET_BEGINNING,d3
CALLDOS_PC Seek
move.l Filehandle(pc),d1
move.l Size(pc),d3
sub.l .Offset(pc),d3
cmp.l #512,d3
bls.s .L1
move.l #512,d3
.L1 move.l d3,d5
move.l #Puffer2,d2
CALLDOS_PC Read
cmp.l d0,d5
bne OpenError
lea.l Puffer2,a0
lea.l Puffer,a1
lea.l UndoPuffer,a2
move.l #511,d0
.L2 move.b (a0),(a1)+
move.b (a0)+,(a2)+
dbra d0,.L2
move.l d5,AnzahlBytes
move.l .Offset(pc),Offset
.Error bra NewBlock
.Offset dc.l 0
WindowPointer set Window1
SectorNumber move.l Size(pc),d0 ; show current sector number and number of sectors
divu #512,d0
move.l d0,d1
swap d1
and.l #$ffff,d0
tst.w d1
beq.s .SN1
addq #1,d0
.SN1 lea.l SN_Text+12(pc),a0
bsr SN_Number
move.l d7,d0
lea.l PrintHeader2+9,a0
bsr SN_Number
move.l Offset(pc),d0
add.l #511,d0
divu #512,d0
move.l d0,d1
swap d1
and.l #$ffff,d0
tst.w d1
beq.s .SN2
addq #1,d0
.SN2 move.l d0,d7
lea.l SN_Text+5(pc),a0
bsr SN_Number
move.l d7,d0
lea.l PrintHeader2+9,a0
bsr SN_Number
SETBPEN #2
SETDRMD #RP_JAM2
move.l WindowPointer(pc),a1
move.l wd_RPort(a1),a1
move.l FONT80(pc),a0
CALLGRAF_PC SetFont
WRITEMEM #(32+1+7+1)*8+8,#11+3+6,#1,SN_Text,#17
rts
SN_Number moveq.l #4,d2
moveq.l #0,d3
lea.l SN_Potenzen(pc),a2
SN_Z1 move.b #"0"-1,d1
SN_Z2 addq #1,d1
sub.l (a2),d0
bcc.s SN_Z2
add.l (a2)+,d0
tst.b d2
beq.s SN_Z3
cmp.b #"0",d1
beq.s SN_Z4
moveq.l #1,d3
bra.s SN_Z3
SN_Z4 tst.b d3
bne.s SN_Z3
move.b #" ",d1
SN_Z3 move.b d1,(a0)+
dbra d2,SN_Z1
rts
SN_Potenzen dc.l 10000
dc.l 1000
dc.l 100
dc.l 10
dc.l 1
SN_Text dc.b "Sec :..... /....."
FORWARD tst.b FlagFile ; next sector
beq.s .Nothing
move.l Offset(pc),d0
add.l #512,d0
cmp.l Size(pc),d0
bge.s .Nothing
bsr WriteQuestion
move.l Offset(pc),d0
add.l #512,d0
bra GetBlock
.Nothing bra wait
BACKWARD tst.b FlagFile ; previous sector
beq.s .Nothing
move.l Offset(pc),d0
sub.l #512,d0
tst.l d0
bmi.s .Nothing
bsr WriteQuestion
move.l Offset(pc),d0
sub.l #512,d0
bra GetBlock
.Nothing bra wait
UNDO tst.b FlagFile ; next sector
beq.s .Nothing
lea.l UndoPuffer,a0
lea.l Puffer,a1
move.l #511,d0
.L1 move.b (a0)+,(a1)+
dbra d0,.L1
bra NewBlock
.Nothing bra wait
*
* write sector
*
WRITE bsr SaveBlock
bsr ShowPuffer
lea.l Color,a0
move.l #511,d0
.L1 move.b #3,(a0)+
dbra d0,.L1
move.l Cursor(pc),d0
bsr SetCursor
bra NewPos
SaveBlock tst.l Memory ; Save current block
beq.s .SaveBlockDisk ; Subroutine
move.l Memory(pc),a0
move.l a0,a5
add.l Offset(pc),a0
lea.l Puffer,a1
lea.l UndoPuffer,a2
add.l Size(pc),a5
move.w #511,d0
.L0 cmp.l a0,a5 ; reached end of file ?????
beq.s .L1 ; (in that case V1.11 crashed)
move.b (a1),(a0)+
move.b (a1)+,(a2)+
dbra d0,.L0
.L1 move.b #1,FlagWrite
rts
.SaveBlockDisk move.l Filehandle(pc),d1 ; write block to device
tst.l d1
beq.s .Error
move.l Offset(pc),d2
moveq.l #OFFSET_BEGINNING,d3
CALLDOS_PC Seek
move.l Filehandle(pc),d1
move.l #Puffer,d2
move.l AnzahlBytes,d3
CALLDOS_PC Write
cmp.l d3,d0
bne.s .DiskError
lea.l Puffer,a1
lea.l UndoPuffer,a2
move.l #511,d0
.L2 move.b (a1)+,(a2)+
dbra d0,.L2
.Error rts
.DiskError lea.l 4(sp),sp ; Leave subroutine with returning
bra OpenError
*
* SAVE AS - you mustn't edit on device
*
SAVE_Text dc.b " Save File: "
even
SAVE tst.b FlagFile
beq .wait
tst.l Memory
beq RAM_ONLY
bsr WriteQuestion
lea.l SAVE_Text(pc),a5 ; Save file
move.l #R_G1,R_def+nw_FirstGadget
bsr FileRequester
tst.l d0
beq .wait
move.l d0,.File
move.l .File(pc),d1 ; Copy file from RAM to device
move.l #MODE_NEWFILE,d2
CALLDOS_PC Open
tst.l d0
beq OpenError
move.l d0,Filehandle
move.l d0,d1
move.l Size(pc),d3
move.l Memory(pc),d2
CALLDOS_PC Write
cmp.l d3,d0
bne DiskError
move.l Filehandle(pc),d1
CALLDOS_PC Close
clr.b FlagWrite
.wait bra wait
.File dc.l 0
*
* error message - "you mustn't edit on device !"
*
WindowPointer set Window2
RAM_ONLY move.l ScreenPtr1(pc),a0
CALLINT_PC DisplayBeep
lea.l Windowdef2(pc),a0
bsr MakeWindow
tst.l d0
beq .wait
move.l d0,Window2
SETDRMD #RP_JAM1
WRITE #6+(290-28*8)/2,#19+10,#0,<"You mustn't edit on device !">
WRITE #5+(290-28*8)/2,#18+10,#1,<"You mustn't edit on device !">
move.l Window2(pc),a0
move.l wd_UserPort(a0),a0
move.l a0,a5
CALLEXEC WaitPort
move.l Window2(pc),a0
CALLINT_PC CloseWindow
.wait bra wait
*
* question "Do ya really wanna quit ?"
*
WindowPointer set Window2
Windowdef3 dc.w 60,50,300,70
dc.b -1,-1
dc.l GADGETUP!VANILLAKEY
dc.l ACTIVATE!SMART_REFRESH!RMBTRAP
dc.l LE_Gadget1
dc.l 0
dc.l 0
dc.l 0,0
dc.w 0,0,0,0,CUSTOMSCREEN
LE_Gadget1 FM_GADGET LE_Gadget2,50,50,50,1,<"NO">,1,4
LE_Gadget2 FM_GADGET 0,200,50,50,0,<"YES">,1,4
LEAVE lea.l Windowdef3(pc),a0
bsr MakeWindow
tst.l d0
beq .wait
move.l d0,Window2
SETDRMD #RP_JAM1
WRITE #6+(290-28*8)/2,#19+10,#0,<"Do you really want to quit ?">
WRITE #5+(290-28*8)/2,#18+10,#1,<"Do you really want to quit ?">
.WAIT move.l Window2(pc),a0 ; wait .....
move.l wd_UserPort(a0),a0
move.l a0,a5
CALLEXEC WaitPort
move.l a5,a0
CALLEXEC GetMsg ; get message
move.l d0,a1
move.l im_Class(a1),d4 ; get data
move.w im_Code(a1),d5
move.l im_IAddress(a1),a4
CALLEXEC ReplyMsg ; reply message
moveq.l #0,d0
cmp.l #VANILLAKEY,d4
beq.s .Key
move.l Window2(pc),a0
CALLINT_PC CloseWindow
moveq.l #0,d0
move.w gg_GadgetID(a4),d0
.wait rts
.Key cmp.b #"y",d5
beq.s .Yes ; yes
cmp.b #"Y",d5
beq.s .Yes ; yes
cmp.b #"N",d5
beq.s .No
cmp.b #"n",d5
bne .WAIT
.No moveq.l #10,d1
CALLDOS_PC Delay
move.l Window2(pc),a0
CALLINT_PC CloseWindow
moveq.l #1,d0
rts
.Yes moveq.l #10,d1
CALLDOS_PC Delay
move.l Window2(pc),a0
CALLINT_PC CloseWindow
moveq.l #0,d0
rts
*
* Question "Write sector ?" & write sector
*
WriteQuestion move.l (sp)+,.Return
lea.l Color,a0 ; check, if you've changed anything
move.l #511,d0
.A1 cmp.b #1,(a0)+
beq.s .A2
dbra d0,.A1
bra .NoWrite
.A2 cmp.b #1,WriteMode ; which mode ?
beq .Autowrite
cmp.b #2,WriteMode
beq .NoWrite
lea.l Windowdef3(pc),a0
bsr MakeWindow
tst.l d0
beq .NoWrite
move.l d0,Window2
SETDRMD #RP_JAM1
WRITE #6+(290-24*8)/2,#19,#0,<"Do you want to write the">
WRITE #6+(290-8*8)/2,#19+15,#0,<"sector ?">
WRITE #5+(290-24*8)/2,#18,#1,<"Do you want to write the">
WRITE #5+(290-8*8)/2,#18+15,#1,<"sector ?">
.WAIT move.l Window2(pc),a0 ; wait .....
move.l wd_UserPort(a0),a0
move.l a0,a5
CALLEXEC WaitPort
move.l a5,a0
CALLEXEC GetMsg ; get message
move.l d0,a1
move.l im_Class(a1),d4 ; get data
move.w im_Code(a1),d5
move.l im_IAddress(a1),a4
CALLEXEC ReplyMsg ; reply message
moveq.l #0,d0
cmp.l #VANILLAKEY,d4
beq.s .Key
move.l Window2(pc),a0
CALLINT_PC CloseWindow
moveq.l #0,d0
move.w gg_GadgetID(a4),d0
.wait bra.s .DoIT
.Key cmp.b #"y",d5
beq.s .Yes ; yes
cmp.b #"Y",d5
beq.s .Yes ; yes
cmp.b #"N",d5
beq.s .No
cmp.b #"n",d5
bne .WAIT
.No moveq.l #10,d1
CALLDOS_PC Delay
move.l Window2(pc),a0
CALLINT_PC CloseWindow
moveq.l #1,d0
bra.s .DoIT
.Yes moveq.l #10,d1
CALLDOS_PC Delay
move.l Window2(pc),a0
CALLINT_PC CloseWindow
moveq.l #0,d0
.DoIT tst.b d0
bne.s .NoWrite
.Autowrite bsr SaveBlock ; write sector
bsr ShowPuffer
lea.l Color,a0
move.l #511,d0
.L1 move.b #3,(a0)+
dbra d0,.L1
.NoWrite move.l .Return(pc),a0
jmp (a0)
.Return dc.l 0
*
* change colours
*
* the basic palette program was taken from XColor 1.2 . The public
* domain program of mine was published on FISH 244.
*
*
_MathBase dc.l 0
Mathname FFPNAME
COLOUR move.w #$ff,Colour_Mode
lea Mathname(pc),a1
moveq.l #0,d0
CALLEXEC OpenLibrary
move.l d0,_MathBase
bne.s .C1
.C0 bra wait
.C1 clr.b Colour_Mode ; set to normal mode
move.b #$ff,OldColour_Mode
lea.l NewWindow1(pc),a0
bsr MakeWindow ; open the window
tst.l d0
beq.s .C0
move.l d0,Window1_Ptr
move.l d0,a1
move.l wd_RPort(a1),a1
moveq.l #7,d0
CALLGRAF_PC SetBPen
bsr GetDepth
bsr SaveForUndo ; save color for undo function
IN3
IN1 move.l Window1_Ptr(pc),a1 ; draw border
move.l wd_RPort(a1),a0
lea.l CG_Box(pc),a1
moveq.w #10,d0
move.w #15,d1
CALLINT_PC DrawBorder
IN0 lea.l Colour_Gadget1(pc),a0 ; refresh gadgets
move.l Window1_Ptr(pc),a1
sub.l a2,a2
CALLINT_PC RefreshGadgets
clr.l COLOR ; current color = 0
bsr GetDepth ; get depth
bsr MakeCG ; create color gadget
IN2 bsr NewColor ; edit new color
bsr RGB ; write R,G,B
Colour_wait lea.l Colour_Gadget1(pc),a0 ; refresh gadgets again
move.l Window1_Ptr(pc),a1
sub.l a2,a2
CALLINT_PC RefreshGadgets
move.l Window1_Ptr(pc),a1
move.l wd_RPort(a1),a1
move.l a1,a2
moveq.l #1,d0
CALLGRAF_PC SetAPen
move.l a2,a1
move.w #(185-13*8)/2,d0
move.w #10,d1
CALLGRAF_PC Move
moveq.l #0,d0
move.b Colour_Mode(pc),d0
cmp.b OldColour_Mode(pc),d0
beq.s Colour_wait2
move.b d0,OldColour_Mode
mulu #14,d0
add.l #Title0,d0
move.l d0,a0
move.l #13,d0
move.l a2,a1
CALLGRAF_PC Text
Colour_wait2 move.l Window1_Ptr(pc),a0 ; wait .....
move.l wd_UserPort(a0),a0
move.l a0,a5
CALLEXEC WaitPort
move.l a5,a0
CALLEXEC GetMsg ; get message
move.l d0,a1
move.l im_Class(a1),d4 ; get data
move.w im_Code(a1),d5
move.l im_IAddress(a1),a4
move.w im_MouseX(a1),d6
move.w im_MouseY(a1),d7
CALLEXEC ReplyMsg ; reply message
cmp.l #GADGETDOWN,d4
beq G1_HandlerA
moveq.l #0,d0
move.w gg_GadgetID(a4),d0
tst.w d0
beq G0_Handler
cmp.w #3,d0
bls G1_HandlerB
cmp.w #7,d0
beq UNDO_colour
cmp.b #10,d0
beq Black_White
cmp.b #5,d0
beq UNDO_ALL
cmp.b #11,d0
beq ANTIK
cmp.b #4,d0
beq QUIT_color
cmp.b #12,d0
beq COPY
cmp.b #13,d0
beq EXCHANGE
cmp.b #14,d0
beq SPREAD
cmp.b #20,d0
beq DEFAULT
bra Colour_wait
QUIT_color move.l Window1_Ptr(pc),a0 ; the exit
CALLINT_PC CloseWindow
move.l _MathBase(pc),a1
CALLEXEC CloseLibrary
bra wait
MakeCG move.l Depth(pc),d0 ; get size of block
subq #1,d0 ; from table and draw
lsl.l #2,d0 ; the blocks
lea.l SizeTable(pc),a0
move.w (a0,d0),d6
move.w 2(a0,d0),d7
moveq.l #0,d5
move.w #0,-(sp)
MCG0 moveq.l #0,d4
MCG1 move.w (sp),d0
move.l Window1_Ptr(pc),a1
move.l wd_RPort(a1),a1
move.l a1,a3
CALLGRAF_PC SetAPen
move.l a3,a1
move.w d4,d0
move.w d5,d1
add.w d6,d4
move.w d4,d2
move.w d5,d3
add.w d7,d3
add #10,d0
add #15,d1
add #10,d2
add #15,d3
CALLGRAF_PC RectFill
add.w #1,(sp)
cmp.w #159,d4
bls MCG1
MCG2 add.w d7,d5
cmp.w #39,d5
bls MCG0
lea.l 2(sp),sp
rts
Depth dc.l 0
SizeTable dc.w 160/2,40/1 ; 2 colors
dc.w 160/2,40/2 ; 4 colors
dc.w 160/4,40/2 ; 8 colors
dc.w 160/4,40/4 ; 16 colors
dc.w 160/8,40/4 ; 32 colors
dc.w 160/16,40/4 ; 64 colors
Colour_Gadget0 dc.l Colour_Gadget10
dc.w 10,15,160,40
dc.w GADGHNONE
dc.w RELVERIFY
dc.w BOOLGADGET
dc.l 0,0
dc.l 0
dc.l 0,0
dc.w 0
dc.l 0
Colour_Gadget1 dc.l Colour_Gadget2
dc.w 40+10,50+15,114,11
dc.w GADGHCOMP
dc.w RELVERIFY!GADGIMMEDIATE
dc.w PROPGADGET
dc.l G1_image,0
dc.l 0
dc.l 0,G1_info
dc.w 1
dc.l 0
G1_image ds.w 4
G1_info dc.w FREEHORIZ!AUTOKNOB
dc.w 0
dc.w 0
dc.w $ffff/15
ds.w 7
Colour_Gadget2 dc.l Colour_Gadget3
dc.w 40+10,50+30,114,11
dc.w GADGHCOMP
dc.w RELVERIFY!GADGIMMEDIATE
dc.w PROPGADGET
dc.l G2_image,0
dc.l 0
dc.l 0,G2_info
dc.w 2
dc.l 0
G2_image ds.w 4
G2_info dc.w FREEHORIZ!AUTOKNOB
dc.w 0
dc.w 0
dc.w $ffff/15
ds.w 7
Colour_Gadget3 dc.l Colour_Gadget7
dc.w 40+10,50+45,114,11
dc.w GADGHCOMP
dc.w RELVERIFY!GADGIMMEDIATE
dc.w PROPGADGET
dc.l G3_image,0
dc.l 0
dc.l 0,G3_info
dc.w 3
dc.l 0
G3_image ds.w 4
G3_info dc.w FREEHORIZ!AUTOKNOB
dc.w 0
dc.w 0
dc.w $ffff/15
ds.w 7
Colour_Gadget7 dc.l 0
dc.w 11,66,20,30
dc.w GADGHBOX
dc.w RELVERIFY
dc.w BOOLGADGET
dc.l C_Box,0
dc.l 0
dc.l 0,0
dc.w 7
dc.l 0
Colour_Gadget10
FM_GADGET Colour_Gadget11,185,3,72,10,<"B&W">,1,4
Colour_Gadget11
FM_GADGET Colour_Gadget12,185,3+(1*14),72,11,<"Antik">,1,4
Colour_Gadget12
FM_GADGET Colour_Gadget13,185,3+(2*14),72,12,<"Copy">,1,4
Colour_Gadget13
FM_GADGET Colour_Gadget14,185,3+(3*14),72,13,<"Exchange">,1,4
Colour_Gadget14
FM_GADGET Colour_Gadget15,185,3+(4*14),72,14,<"Spread">,1,4
Colour_Gadget15
FM_GADGET Colour_Gadget16,185,3+(5*14),72,5,<"Undo All">,1,4
Colour_Gadget16
FM_GADGET Colour_Gadget17,185,3+(6*14),72,20,<"Default">,1,4
Colour_Gadget17
FM_GADGET Colour_Gadget1,185,3+(7*14),72,4,<"EXIT">,1,4
NewWindow1 dc.w 110,45
dc.w 270,116
dc.b -1,-1
dc.l GADGETUP!GADGETDOWN
dc.l ACTIVATE!SMART_REFRESH
dc.l Colour_Gadget0
dc.l 0
dc.l 0
dc.l 0
dc.l 0
dc.w 140,100
dc.w 140,100
dc.w CUSTOMSCREEN
Window1_Ptr dc.l 0 ; window pointer
Undo dc.w 0 ; undo
CG_Box BOX -1,-1,161,41,1,0
C_Box BOX -1,-1,20,30,1,0
COLOR dc.l 0 ; current color
MoverSize dc.w 0 ; size of mover ($ffff/15 or $ffff/7)
NewColor move.w #$ffff/15,d0 ; edit a new color
cmp.l #$1f,COLOR ; color is halfbrite ( >$1f) => mover is smaller !
bls NC0
move.w #$ffff/7,d0
NC0 move.w d0,MoverSize
move.l Window1_Ptr(pc),a1 ; write color number
move.l wd_RPort(a1),a1
move.l a1,a2
moveq.l #1,d0
CALLGRAF_PC SetAPen
move.l a2,a1
move.w #12,d0
move.w #50+15+6+1+15+15+2,d1
CALLGRAF_PC Move
lea.l Zahlen2(pc),a0
move.l COLOR(pc),d0
add.l d0,d0
add.l d0,a0
moveq.l #2,d0
CALLGRAF_PC Text
move.l Window1_Ptr(pc),a0 ; get RGB and save for undo !
CALLINT_PC ViewPortAddress
move.l d0,a0
move.l vp_ColorMap(a0),a0
move.l COLOR(pc),d0
CALLGRAF_PC GetRGB4
move.w d0,Undo
move.w d0,-(sp) ; remake prop-gadgets
lsr.w #8,d0
and.w #$f,d0
moveq.l #0,d1
move.b d0,d1
mulu.w MoverSize(pc),d1
lea.l Colour_Gadget1(pc),a0
move.l Window1_Ptr(pc),a1
sub.l a2,a2
moveq.l #0,d2
move.w MoverSize(pc),d3
moveq.l #0,d4
move.w #FREEHORIZ!AUTOKNOB,d0
CALLINT_PC ModifyProp
moveq.l #0,d1
move.w (sp),d1
lsr.w #4,d1
and.w #$f,d1
mulu.w MoverSize(pc),d1
lea.l Colour_Gadget2(pc),a0
move.l Window1_Ptr(pc),a1
sub.l a2,a2
moveq.l #0,d2
move.w MoverSize(pc),d3
moveq.l #0,d4
move.w #FREEHORIZ!AUTOKNOB,d0
CALLINT_PC ModifyProp
moveq.l #0,d1
move.w (sp)+,d1
and.w #$f,d1
mulu.w MoverSize(pc),d1
lea.l Colour_Gadget3(pc),a0
move.l Window1_Ptr(pc),a1
sub.l a2,a2
moveq.l #0,d2
move.w MoverSize(pc),d3
moveq.l #0,d4
move.w #FREEHORIZ!AUTOKNOB,d0
CALLINT_PC ModifyProp
move.l Window1_Ptr(pc),a1 ; draw block for undo gadget
move.l wd_RPort(a1),a1
move.l COLOR(pc),d0
CALLGRAF_PC SetAPen
move.l Window1_Ptr(pc),a1
move.l wd_RPort(a1),a1
move.w #10+1,d0
move.w #15+50+1,d1
move.w #10+19+1,d2
move.w #15+50+29+1,d3
CALLGRAF_PC RectFill
bra Print_HEX ; write mover positions as numbers
G0_Handler cmp.b #1,Colour_Mode
beq Copy_Color
cmp.b #2,Colour_Mode
beq Exchange_Color
cmp.b #3,Colour_Mode
beq Spread_Color
move.w d6,d0 ; color gadget was selected but
move.w d7,d1 ; which color ?
move.l Window1_Ptr(pc),a1
move.l wd_RPort(a1),a1
CALLGRAF_PC ReadPixel
move.l d0,COLOR
bsr NewColor
bra Colour_wait
Zahlen dc.b "0123456789ABCDEF"
Zahlen2 dc.b "000102030405060708090a0b0c0d0e0f"
dc.b "101112131415161718191a1b1c1d1e1f"
Print_HEX move.l Window1_Ptr(pc),a0 ; write mover position as hex number
CALLINT_PC ViewPortAddress
move.l d0,a0
move.l vp_ColorMap(a0),a0
move.l COLOR(pc),d0
CALLGRAF_PC GetRGB4
move.w d0,d5
move.l Window1_Ptr(pc),a1
move.l wd_RPort(a1),a1
move.l a1,a2
moveq.l #1,d0
CALLGRAF_PC SetAPen
move.l a2,a1
move.w #114+50+4,d0
move.w #50+15+6+2,d1
CALLGRAF_PC Move
lea.l Zahlen(pc),a0
move.l d5,d0
lsr.l #8,d0
and.l #$f,d0
add.l d0,a0
moveq.l #1,d0
CALLGRAF_PC Text
move.l a2,a1
move.w #114+50+4,d0
move.w #50+15+6+15+2,d1
CALLGRAF_PC Move
lea.l Zahlen(pc),a0
move.l d5,d0
lsr.l #4,d0
and.l #$f,d0
add.l d0,a0
moveq.l #1,d0
CALLGRAF_PC Text
move.l a2,a1
move.w #114+50+4,d0
move.w #50+15+6+15+15+2,d1
CALLGRAF_PC Move
lea.l Zahlen(pc),a0
and.l #$f,d5
add.l d5,a0
moveq.l #1,d0
CALLGRAF_PC Text
rts
G1_HandlerA bsr ReadColor ; prop gadget was selected
bsr Print_HEX
move.l Window1_Ptr(pc),a0
move.l wd_UserPort(a0),a0
CALLEXEC GetMsg
tst.l d0
beq.s G1_HandlerA
move.l d0,a1
CALLEXEC ReplyMsg
G1_HandlerB bsr ReadColor ; " (but left button was released afterwards)
bsr Print_HEX
bra Colour_wait
ReadColor move.l Window1_Ptr(pc),a0 ; get mover position and set RGB
CALLINT_PC ViewPortAddress
move.l d0,a0
moveq.l #0,d1
moveq.l #0,d2
moveq.l #0,d3
move.w G1_info+2(pc),d1
divu G1_info+6(pc),d1
move.w G2_info+2(pc),d2
divu G2_info+6(pc),d2
move.w G3_info+2(pc),d3
divu G3_info+6(pc),d3
move.l COLOR(pc),d0
CALLGRAF_PC SetRGB4
rts
UNDO_colour move.l Window1_Ptr(pc),a0 ; undo color
CALLINT_PC ViewPortAddress
move.l d0,a0
move.l COLOR(pc),d0
move.w Undo(pc),d1
move.w d1,d2
move.w d2,d3
lsr.w #8,d1
and.l #$f,d1
lsr.w #4,d2
and.l #$f,d2
and.l #$f,d3
CALLGRAF_PC SetRGB4
bsr NewColor
bra Colour_wait
GetDepth move.l ScreenPtr1,a0 ; get depth (HAM=4!)
lea.l sc_BitMap(a0),a0
moveq.l #0,d0
move.b bm_Depth(a0),d0
move.l d0,Depth
rts
R dc.b "R"
G dc.b "G"
B dc.b "B"
RGB move.l Window1_Ptr(pc),a1 ; print out R, G , B
move.l wd_RPort(a1),a1
move.l a1,a2
moveq.l #1,d0
CALLGRAF_PC SetAPen
move.l a2,a1
move.w #40,d0
move.w #50+15+6+2,d1
CALLGRAF_PC Move
lea.l R(pc),a0
moveq.l #1,d0
CALLGRAF_PC Text
move.l a2,a1
move.w #40,d0
move.w #50+15+6+15+2,d1
CALLGRAF_PC Move
lea.l G(pc),a0
moveq.l #1,d0
CALLGRAF_PC Text
move.l a2,a1
move.w #40,d0
move.w #50+15+6+15+15+2,d1
CALLGRAF_PC Move
lea.l B(pc),a0
moveq.l #1,d0
CALLGRAF_PC Text
rts
even
ColorBuffer ds.w 64
UNDOBuffer ds.w 64
UNDODepth dc.l 0
* How to make B&W
*
* C=r+g+b ; add all three parts red, green, blue
* r=g=b=C/3 ; new parts
Black_White move.l Window1_Ptr(pc),a0
CALLINT_PC ViewPortAddress
move.l d0,a0
move.l Depth(pc),d0 ; copy colors to buffer
moveq.l #0,d1
bset d0,d1
subq #1,d1
move.l vp_ColorMap(a0),a0
move.l cm_ColorTable(a0),a0
lea.l ColorBuffer(pc),a1
.X move.w (a0)+,(a1)+
dbra d1,.X
move.l Depth(pc),d0 ; convert colors to b&W
moveq.l #0,d1
bset d0,d1
subq #1,d1
lea.l ColorBuffer(pc),a1
.Y moveq.l #0,d0
add.b (a1),d0
moveq.l #0,d2
move.b 1(a1),d2
move.b d2,d3
and.b #$f,d3
lsr.b #4,d2
add.b d2,d0
add.b d3,d0
and.l #$ff,d0
divu #3,d0
move.b d0,(a1)+
move.b d0,d2
lsl.b #4,d0
or.b d2,d0
move.b d0,(a1)+
dbra d1,.Y
move.l Window1_Ptr(pc),a0
CALLINT_PC ViewPortAddress
move.l d0,a0
lea.l ColorBuffer(pc),a1
move.l Depth(pc),d1
moveq.l #0,d0
bset d1,d0
CALLGRAF_PC LoadRGB4
CALLINT_PC RemakeDisplay
bra IN2
* How to make ANTIK
*
* C=r+g+b ; add all three parts red, green, blue
* r=C/3 ; new parts
* g=C/4
* b=C/5
ANTIK move.l Window1_Ptr(pc),a0
CALLINT_PC ViewPortAddress
move.l d0,a0
move.l Depth(pc),d0 ; copy colors to buffer
moveq.l #0,d1
bset d0,d1
subq #1,d1
move.l vp_ColorMap(a0),a0
move.l cm_ColorTable(a0),a0
lea.l ColorBuffer(pc),a1
.X move.w (a0)+,(a1)+
dbra d1,.X
move.l Depth(pc),d0 ; convert colors to b&W
moveq.l #0,d1
bset d0,d1
subq #1,d1
lea.l ColorBuffer(pc),a1
.Y moveq.l #0,d0
add.b (a1),d0
moveq.l #0,d2
move.b 1(a1),d2
move.b d2,d3
and.b #$f,d3
lsr.b #4,d2
add.b d2,d0
add.b d3,d0
and.l #$ff,d0
move.l d0,d5
divu #3,d0
move.b d0,(a1)+
move.l d5,d0
lsl.w #2,d0
and.w #$f0,d0
divu #5,d5
or.b d5,d0
move.b d0,(a1)+
dbra d1,.Y
move.l Window1_Ptr(pc),a0
CALLINT_PC ViewPortAddress
move.l d0,a0
lea.l ColorBuffer(pc),a1
move.l Depth(pc),d1
moveq.l #0,d0
bset d1,d0
CALLGRAF_PC LoadRGB4
CALLINT_PC RemakeDisplay
bra IN2
SaveForUndo move.l Window1_Ptr(pc),a0
CALLINT_PC ViewPortAddress
move.l d0,a0
move.l Depth(pc),d0
moveq.l #0,d1
bset d0,d1
cmp.b #32,d1
bls.s .Z
move.l #32,d1
.Z move.l d1,UNDODepth
subq #1,d1
move.l vp_ColorMap(a0),a0
move.l cm_ColorTable(a0),a0
lea.l UNDOBuffer(pc),a1
.X move.w (a0)+,(a1)+
dbra d1,.X
rts
UNDO_ALL move.l Window1_Ptr(pc),a0 ; restor save color map
CALLINT_PC ViewPortAddress
move.l d0,a0
lea.l UNDOBuffer(pc),a1
move.l UNDODepth(pc),d0
CALLGRAF_PC LoadRGB4
CALLINT_PC RemakeDisplay
bra IN3
Colour_Mode dc.b 0
OldColour_Mode dc.b $ff
even
Title0 dc.b " Colours ",0
Title1 dc.b " Copy to : ",0
Title2 dc.b "Exchange to :",0
Title3 dc.b " Spread to : ",0
COPY cmp.b #1,Colour_Mode
beq.s .Label1
move.b #1,Colour_Mode
bra Colour_wait
.Label1 clr.b Colour_Mode
bra Colour_wait
Copy_Color move.l Window1_Ptr(pc),a0
CALLINT_PC ViewPortAddress
move.l d0,a0
move.l vp_ColorMap(a0),a0
move.l cm_ColorTable(a0),a3 ; pointer color map
move.w d6,d0 ; get color
move.w d7,d1
move.l Window1_Ptr(pc),a1
move.l wd_RPort(a1),a1
CALLGRAF_PC ReadPixel
move.l d0,d3 ; You can only change colours between 0 and $1f or between $20 and $3f
move.l COLOR(pc),d4
and.b #$20,d3
and.b #$20,d4
cmp.b d3,d4
bne Colour_Error
and.w #$1f,d0 ; change colours ( EHB colour-> normal colour)
add.w d0,d0
move.l COLOR(pc),d1
and.w #$1f,d1
add.w d1,d1
move.w (a3,d1),(a3,d0) ; copy it !
clr.b Colour_Mode
CALLINT_PC RemakeDisplay
bra IN2
EXCHANGE cmp.b #2,Colour_Mode
beq.s .Label1
move.b #2,Colour_Mode
bra Colour_wait
.Label1 clr.b Colour_Mode
bra Colour_wait
Exchange_Color move.l Window1_Ptr(pc),a0
CALLINT_PC ViewPortAddress
move.l d0,a0
move.l vp_ColorMap(a0),a0
move.l cm_ColorTable(a0),a3 ; pointer color map
move.w d6,d0 ; get color
move.w d7,d1
move.l Window1_Ptr(pc),a1
move.l wd_RPort(a1),a1
CALLGRAF_PC ReadPixel
move.l d0,d3 ; You can only change colours between 0 and $1f or between $20 and $3f
move.l COLOR(pc),d4
and.b #$20,d3
and.b #$20,d4
cmp.b d3,d4
bne Colour_Error
and.l #$1f,d0
add.w d0,d0
move.l COLOR(pc),d1
and.l #$1f,d1
add.w d1,d1
move.w (a3,d1),d2 ; exchange it !
move.w (a3,d0),(a3,d1)
move.w d2,(a3,d0)
clr.b Colour_Mode
CALLINT_PC RemakeDisplay
bra IN2
DefaultPalette dc.w $000,$eee,$775,$313,$04d,$997,$4b9,$553
DEFAULT move.l Window1_Ptr(pc),a0 ; set default colors
CALLINT_PC ViewPortAddress
move.l d0,a0
move.w #16,d0
lea.l Palette,a1
CALLGRAF_PC LoadRGB4
CALLINT_PC RemakeDisplay
bra IN2
SPREAD cmp.b #3,Colour_Mode
beq.s .Label1
move.b #3,Colour_Mode
bra Colour_wait
.Label1 clr.b Colour_Mode
bra Colour_wait
Spread_Color move.l Window1_Ptr(pc),a0
CALLINT_PC ViewPortAddress
move.l d0,a0
move.l vp_ColorMap(a0),a0
move.l cm_ColorTable(a0),a3 ; pointer color map
move.w d6,d0 ; get color
move.w d7,d1
move.l Window1_Ptr(pc),a1
move.l wd_RPort(a1),a1
CALLGRAF_PC ReadPixel
move.l COLOR(pc),d1
P cmp.w d1,d0
bls.s .L1
move.l d0,d2
move.l d1,d0
move.l d2,d1
.L1 move.l d1,d2
sub.l d0,d2
cmp.l #1,d2
bls .exit
move.l d0,d3 ; You can only change colours between 0 and $1f or between $20 and $3f
move.l d1,d4
and.b #$20,d3
and.b #$20,d4
cmp.b d3,d4
bne Colour_Error
and.l #$1f,d0
and.l #$1f,d1
move.l d0,FirstColor
move.l d1,LastColor
move.l d2,DiffColor
move.l d2,d6
subq #2,d6
move.l FirstColor(pc),d0 ;get RGB of first colour
bsr ReadColorII
movem.l d0-d2,FirstR
move.l LastColor(pc),d0 ;get RGB of last colour
bsr ReadColorII
sub.l FirstR(pc),d0
move.l d0,DiffR ; What's the difference ?
sub.l FirstG(pc),d1
move.l d1,DiffG
sub.l FirstB(pc),d2
move.l d2,DiffB
moveq.l #6,d4 ; convert integer to FFP
lea.l FirstR(pc),a3
.L2 move.l (a3),d0
CALLFFP SPFlt
move.l d0,(a3)+
dbra d4,.L2
lea.l DiffR(pc),a3
lea.l FaktorR(pc),a4
move.l (a3)+,d0 ; How much R (,G,B) has to be added each colour ?
move.l DiffColor(pc),d1
CALLFFP SPDiv
move.l d0,(a4)+
move.l (a3)+,d0
move.l DiffColor(pc),d1
CALLFFP SPDiv
move.l d0,(a4)+
move.l (a3)+,d0
move.l DiffColor(pc),d1
CALLFFP SPDiv
move.l d0,(a4)+
.L3 lea.l FirstR(pc),a3
lea.l FaktorR(pc),a4
lea.l R_Wert(pc),a5
move.l (a3),d0 ; add to R,G,B
move.l (a4)+,d1
CALLFFP SPAdd
move.l d0,(a3)+
CALLFFP SPFix ; convert result to integer
move.l d0,(a5)+
move.l (a3),d0
move.l (a4)+,d1
CALLFFP SPAdd
move.l d0,(a3)+
CALLFFP SPFix
move.l d0,(a5)+
move.l (a3),d0
move.l (a4)+,d1
CALLFFP SPAdd
move.l d0,(a3)+
CALLFFP SPFix
move.l d0,(a5)+
addq.l #1,FirstColor ; set colour
move.l FirstColor(pc),d0
movem.l R_Wert(pc),d1-d3
bsr WriteColor
dbra d6,.L3
.exit clr.b Colour_Mode
CALLINT_PC RemakeDisplay ; remake copper list
bra IN2
FirstR dc.l 0
FirstG dc.l 0
FirstB dc.l 0
DiffR dc.l 0
DiffG dc.l 0
DiffB dc.l 0
DiffColor dc.l 0
FaktorR dc.l 0
FaktorG dc.l 0
FaktorB dc.l 0
FirstColor dc.l 0
LastColor dc.l 0
ColorNumber dc.l 0
R_Wert dc.l 0
G_Wert dc.l 0
B_Wert dc.l 0
ReadColorII move.l d0,-(sp)
move.l Window1_Ptr(pc),a0
CALLINT_PC ViewPortAddress
move.l d0,a0
move.l (sp)+,d0
move.l vp_ColorMap(a0),a0
and.l #$1f,d0
CALLGRAF_PC GetRGB4
move.b d0,d1
move.b d0,d2
and.l #$f,d2
lsr.b #4,d1
and.l #$f,d1
lsr.w #8,d0
and.l #$f,d0
rts
WriteColor and.w #$1f,d0
move.l d0,-(sp)
move.l Window1_Ptr(pc),a0
CALLINT_PC ViewPortAddress
move.l d0,a0
move.l (sp)+,d0
CALLGRAF_PC SetRGB4
rts
Colour_Error move.l ScreenPtr1,a0 ; User tried to copy, spread or exchange a normal colour and a EHB colour!
CALLINT_PC DisplayBeep
clr.b Colour_Mode
bra Colour_wait
********************* end of COLOUR
_DOSBase dc.l 0
_GfxBase dc.l 0
_IntuitionBase dc.l 0
*
* goto sector
*
WindowPointer set Window2
Windowdef4 dc.w 60,50,310,100
dc.b -1,-1
dc.l GADGETUP
dc.l ACTIVATE!SMART_REFRESH!RMBTRAP
dc.l GB_Gadget1
dc.l 0
dc.l 0
dc.l 0,0
dc.w 0,0,0,0,CUSTOMSCREEN
GB_Gadget1 FM_GADGET GB_Gadget5,5,80,56,1,<"Cancel">,1,2
GB_Gadget5 FM_GADGET GB_Gadget6,61+5,80,56,5,<"First">,1,4
GB_Gadget6 FM_GADGET GB_Gadget7,122+5,80,56,6,<"Last">,1,4
GB_Gadget7 FM_GADGET GB_Gadget8,183+5,80,56,7,<"Offset">,1,4
GB_Gadget8 FM_GADGET GB_Gadget3,244+5,80,56,8,<"Sector">,1,4
GB_Gadget3 dc.l GB_Gadget4
dc.w 146+5,40-12,10*8,10,GADGHCOMP,RELVERIFY,STRGADGET
dc.l GB_G1_Box,0,0,0,GB_G1_Info
dc.w 100,0,0
GB_G1_Box BOX -1,-1,81,8,2,GB_G1_Box2
GB_G1_Box2 BOX -2,-2,82,9,1,0
GB_G1_Info dc.l GB_G1_Puffer,GB_G1_Undo
dc.w 0,10
ds.w 12
GB_G1_Puffer ds.b 12
GB_G1_Undo ds.b 12
GB_Gadget4 dc.l 0
dc.w 146+5,65-12,10*8,10,GADGHCOMP,RELVERIFY,STRGADGET
dc.l GB_G1_Box,0,0,0,GB_G2_Info
dc.w 101,0,0
GB_G2_Info dc.l GB_G2_Puffer,GB_G2_Undo
dc.w 0,10
ds.w 12
GB_G2_Puffer ds.b 12
GB_G2_Undo ds.b 12
BLOCK tst.b FlagFile ; have you already opened a file ?
beq .wait
move.l Offset,d0
lea.l GB_G2_Puffer(pc),a0
bsr MakeHex
clr.b (a0)
move.l Offset,d0
divu #512,d0
and.l #$ffff,d0
addq #1,d0
lea.l GB_G1_Puffer(pc),a0
bsr MakeZahl
clr.b (a0)
lea.l Windowdef4(pc),a0
bsr MakeWindow
tst.l d0
beq .wait
move.l d0,Window2
SETDRMD #RP_JAM1
WRITE #6+(300-13*8)/2,#11,#0,<"Goto sector :">
WRITE #5+(300-13*8)/2,#10,#1,<"Goto sector :">
WRITE #5+(300-19*8)/2,#40-6,#1,<"Sector : ">
WRITE #5+(300-19*8)/2,#65-6,#1,<"Offset : ">
lea.l GB_Gadget3(pc),a0
move.l WindowPointer(pc),a1
sub.l a2,a2
CALLINT_PC ActivateGadget
move.l Window2(pc),a0 ; wait .....
move.l wd_UserPort(a0),a0
move.l a0,a5
CALLEXEC WaitPort
move.l a5,a0
CALLEXEC GetMsg ; get message
move.l d0,a1
move.l im_Class(a1),d4 ; get data
move.w im_Code(a1),d5
move.l im_IAddress(a1),a4
CALLEXEC ReplyMsg ; reply message
moveq.l #10,d1
CALLDOS_PC Delay
move.l Window2(pc),a0
CALLINT_PC CloseWindow
moveq.l #0,d0
move.w gg_GadgetID(a4),d0
cmp.b #5,d0
beq.s FIRSTBLOCK
cmp.b #6,d0
beq LASTBLOCK
cmp.b #8,d0
beq GOTOBLOCK
cmp.b #100,d0
beq GOTOBLOCK
cmp.b #9,d0
beq GOTOOFFSET
cmp.b #101,d0
beq GOTOOFFSET
.wait bra wait
***************************************
FIRSTBLOCK tst.b FlagFile
beq.s .Nothing
bsr WriteQuestion ; go to 1. sector
moveq.l #0,d0
bra GetBlock
.Nothing bra wait
***************************************
LASTBLOCK tst.b FlagFile
beq.s .Nothing
bsr WriteQuestion ; go to last sector
move.l Size,d0
subq.l #1,d0
and.l #-1-511,d0
bra GetBlock
.Nothing bra wait
****************************************
GOTOBLOCK lea.l GB_G1_Puffer(pc),a0 ; go to special sector
bsr GetZahl
tst.l d1
bne.s .Wally
tst.l d0
beq.s WallyII
subq.l #1,d0
mulu #512,d0
cmp.l Size(pc),d0
bge.s WallyII
move.l d0,.Sector
bsr WriteQuestion
move.l .Sector(pc),d0
bra GetBlock
.Wally move.l ScreenPtr1(pc),a0 ; user is unable to enter a number correctly
CALLINT_PC DisplayBeep
bra BLOCK
.Sector dc.l 0
WallyII lea.l Windowdef2(pc),a0 ; sector doesn't exist !
bsr MakeWindow
tst.l d0
beq .wait
move.l d0,Window2
SETDRMD #RP_JAM1
WRITE #6+(290-22*8)/2,#19+10,#0,<"Sector doesn't exist !">
WRITE #5+(290-22*8)/2,#18+10,#1,<"Sector doesn't exist !">
move.l Window2(pc),a0
move.l wd_UserPort(a0),a0
move.l a0,a5
CALLEXEC WaitPort
move.l Window2(pc),a0
CALLINT_PC CloseWindow
.wait bra wait
****************************************
GOTOOFFSET lea.l GB_G2_Puffer(pc),a0 ; go to special byte
bsr GetZahl
tst.l d1
bne .Wally
cmp.l Size,d0
bge WallyII
move.l d0,.OffsetC
bsr WriteQuestion
move.l .OffsetC(pc),d0
and.l #-1-511,d0
move.l d0,.Offset
tst.l Memory ; get block offset d0
beq.s .GetBlockDisk
move.l Memory(pc),a0
add.l d0,a0
lea.l Puffer,a1
lea.l UndoPuffer,a2
move.w #511,d0
.L0 move.b (a0),(a1)+
move.b (a0)+,(a2)+
dbra d0,.L0
move.l Size,d0
sub.l .Offset(pc),d0
cmp.l #512,d0
bls.s .L3
move.l #512,d0
.L3 move.l d0,AnzahlBytes
move.l .Offset(pc),Offset
bra .NewBlock
.GetBlockDisk move.l Filehandle(pc),d1
tst.l d1
beq .Error
move.l .Offset(pc),d2
moveq.l #OFFSET_BEGINNING,d3
CALLDOS_PC Seek
move.l Filehandle(pc),d1
move.l Size(pc),d3
sub.l .Offset(pc),d3
cmp.l #512,d3
bls .L1
move.l #512,d3
.L1 move.l d3,d5
move.l #Puffer2,d2
CALLDOS_PC Read
cmp.l d0,d5
bne OpenError
lea.l Puffer2,a0
lea.l Puffer,a1
lea.l UndoPuffer,a2
move.w #511,d0
.L2 move.b (a0),(a1)+
move.b (a0)+,(a2)+
dbra d0,.L2
move.l d5,AnzahlBytes
move.l .Offset(pc),Offset
.Error
.NewBlock bsr SectorNumber
tst.l AnzahlBytes
beq NewMode
bsr ShowPuffer
lea.l Color,a0
move.w #511,d0
.L4 move.b #3,(a0)+
dbra d0,.L4
clr.l Cursor
move.l .OffsetC(pc),d0
and.l #511,d0
bsr SetCursor
bsr PrintPosition
and.b #1,Mode
bra NewMode
.Wally move.l ScreenPtr1(pc),a0 ; user is unable to enter a number correctly
CALLINT_PC DisplayBeep
bra BLOCK
.Offset dc.l 0
.OffsetC dc.l 0
****************************************
MakeZahl movem.l d0-d7/a1-a5,-(sp) ; convert d0 into ASCII (a0 ^buffer)
tst.l d0
bpl.s .MZ0
move.b #"-",(a0)+
neg.l d0
.MZ0 moveq.l #9,d2
moveq.l #0,d3
lea.l .MZ_Potenzen(pc),a2
.MZ1 move.b #"0"-1,d1
.MZ2 addq #1,d1
sub.l (a2),d0
bcc.s .MZ2
add.l (a2)+,d0
tst.b d2
beq.s .MZ3
cmp.b #"0",d1
beq.s .MZ4
moveq.l #1,d3
bra.s .MZ3
.MZ4 tst.b d3
beq.s .MZ5
.MZ3 move.b d1,(a0)+
.MZ5 dbra d2,.MZ1
movem.l (sp)+,d0-d7/a1-a5
rts
.MZ_Potenzen dc.l 1000000000
dc.l 100000000
dc.l 10000000
dc.l 1000000
dc.l 100000
dc.l 10000
dc.l 1000
dc.l 100
dc.l 10
dc.l 1
**************************************
MakeHex movem.l d0-d7/a1-a5,-(sp) ; convert d0 into HEX (a0 ^buffer)
tst.l d0
bpl.s .MH0
move.b #"-",(a0)+
neg.l d0
.MH0 move.b #"$",(a0)+
move.l d0,d1
move.l #32-4,d2
lea.l .Hex(pc),a1
moveq.l #0,d3
.MH1 move.l d1,d0
lsr.l d2,d0
and.l #$f,d0
tst.l d2
beq.s .MH3
tst.b d3
bne.s .MH3
tst.b d0
beq.s .MH2
.MH3 move.b (a1,d0),(a0)+
moveq.l #1,d3
.MH2 subq.l #4,d2
cmp.l #-4,d2
bne.s .MH1
movem.l (sp)+,d0-d7/a1-a5
rts
.Hex dc.b "0123456789abcdef"
***************************************
GetZahl movem.l d2-d7/a0-a6,-(sp) ; convert ASCII to number
bsr.s .label20 ; set a0 ^ASCII
tst.l .Invert
beq.s .L21
neg.l d0
.L21 movem.l (sp)+,d2-d7/a0-a6 ; result : d0= number, d1= error flag
rts
.Invert dc.l 0
.label20 cmp.b #" ",(a0)+
beq.s .label20
tst.b -(a0)
clr.l .Invert
cmp.b #"-",(a0)
bne.s .label21
tst.b (a0)+
move.l #-1,.Invert
.label21 move.l a0,a1
cmp.b #"$",(a0) ; Hex ?
beq .GetHex
lea.l .Potenzen-4(pc),a2 ; Pointer to 10^x
moveq.l #0,d0
.label7 tst.b (a0)+
bne.s .label7 ; get last character
tst.b -(a0)
.label8 move.b -(a0),d1
cmp.l a1,a0 ; already reached to first character
bge.s .label9 ; no !
moveq.l #0,d1 ; no error
rts
.label9 tst.l (a2)+ ; next 10^x
beq.s .label12 ; number too high !
sub.b #"0",d1 ;
cmp.b #9,d1 ; useful ?
bhi.s .label12
tst.b d1 ; add as many times as demanded
beq.s .label8 ;
subq #1,d1
and.l #15,d1
.label11 add.l (a2),d0
dbra d1,.label11
bra.s .label8 ; previous character
.label12 moveq.l #-1,d1 ; error !!!
rts
.GetHex tst.b (a0)+ ; do not read "$"
move.l a0,a1
lea.l .Hex(pc),a2 ; Hex table
moveq.l #0,d0
moveq.l #-4,d2 ; d2 = how often has the nibble to be moved to the left
.label13 tst.b (a0)+ : get last character
bne.s .label13
tst.b -(a0)
.label14 move.b -(a0),d1
cmp.l a1,a0 ; already reached the first character
bge.s .label15
moveq.l #0,d1 ; no error
rts
.label15 addq.l #4,d2 ; nibbel has to be moved 4 bits more
cmp.b #32,d2 ; number to high ?
beq.s .label12
moveq.l #-1,d3 ; look up for ascii
.label16 addq #1,d3
cmp.b #32,d3
beq.s .label12
cmp.b (a2,d3),d1
bne.s .label16
and.l #$f,d3
lsl.l d2,d3 ; move nibble to right position in the long word
add.l d3,d0 ; add it
bra.s .label14 ; next character
.Potenzen dc.l 1
dc.l 10
dc.l 100
dc.l 1000
dc.l 10000
dc.l 100000
dc.l 1000000
dc.l 10000000
dc.l 100000000
dc.l 1000000000
dc.l 0
.Hex dc.b "0123456789abcdef"
dc.b "0123456789ABCDEF"
***************************
* change size - add or sub bytes
*
*
Windowdef5 dc.w 60,40,310,130
dc.b -1,-1
dc.l GADGETUP
dc.l ACTIVATE!SMART_REFRESH!RMBTRAP
dc.l SI_Gadget1
dc.l 0
dc.l 0
dc.l 0,0
dc.w 0,0,0,0,CUSTOMSCREEN
SI_Gadget1 FM_GADGET SI_Gadget2,5,110,70,1,<"Cancel">,1,2
SI_Gadget2 FM_GADGET SI_Gadget3,80,110,130,2,<"Create new file">,1,4
SI_Gadget3 FM_GADGET SI_Gadget4,215,110,90,3,<"Same file">,1,4
SI_Gadget4 dc.l SI_Gadget5
dc.w 146+5+16,60-12,10*8,10,GADGHCOMP,RELVERIFY,STRGADGET
dc.l SI_G4_Box,0,0,0,SI_G4_Info
dc.w 4,0,0
SI_G4_Box BOX -1,-1,81,8,2,SI_G4_Box2
SI_G4_Box2 BOX -2,-2,82,9,1,0
SI_G4_Info dc.l SI_G4_Puffer,SI_G4_Undo
dc.w 0,10
ds.w 12
SI_G4_Puffer ds.b 12
SI_G4_Undo ds.b 12
SI_Gadget5 dc.l SI_Gadget6
dc.w 146+5+16,80-12,10*8,10,GADGHCOMP,RELVERIFY,STRGADGET
dc.l SI_G4_Box,0,0,0,SI_G5_Info
dc.w 5,0,0
SI_G5_Info dc.l SI_G5_Puffer,SI_G5_Undo
dc.w 0,10
ds.w 12
SI_G5_Puffer ds.b 12
SI_G5_Undo ds.b 12
SI_Gadget6 dc.l 0
dc.w 146+5+16,100-12,10*8,10,GADGHCOMP,RELVERIFY,STRGADGET
dc.l SI_G4_Box,0,0,0,SI_G6_Info
dc.w 5,0,0
SI_G6_Info dc.l SI_G6_Puffer,SI_G6_Undo
dc.w 0,10
ds.w 12
SI_G6_Puffer ds.b 12
SI_G6_Undo ds.b 12
Size_Top dc.l 0
Size_Bottom dc.l 0
Size_Byte dc.l 0
NS_Text dc.b "Size: / New size: "
even
SIZE tst.b FlagFile ; have you already opened a file ?
beq .wait
tst.l Memory
beq RAM_ONLY
bsr WriteQuestion
move.l Size_Top,d0
lea.l SI_G4_Puffer(pc),a0
bsr MakeZahl
clr.b (a0)
move.l Size_Bottom,d0
lea.l SI_G5_Puffer(pc),a0
bsr MakeZahl
clr.b (a0)
move.l Size_Byte,d0
lea.l SI_G6_Puffer(pc),a0
bsr MakeHex
clr.b (a0)
lea.l Windowdef5(pc),a0
bsr MakeWindow
tst.l d0
beq .wait
move.l d0,Window2
SETDRMD #RP_JAM1
WRITE #6+(300-18*8)/2,#11,#0,<"Change file size :">
WRITE #5+(300-18*8)/2,#10,#1,<"Change file size :">
WRITE #5+(300-23*8)/2,#60-6,#1,<"First byte :">
WRITE #5+(300-23*8)/2,#80-6,#1,<"Last byte :">
WRITE #5+(300-23*8)/2,#100-6,#1,<"Byte :">
lea.l SI_Gadget4(pc),a0
move.l WindowPointer(pc),a1
sub.l a2,a2
CALLINT_PC ActivateGadget
.NewSize move.l Size,d0
lea.l NS_Text+5(pc),a0
bsr SI_PrintSize
move.l Size,d0
add.l Size_Top,d0
add.l Size_Bottom,d0
lea.l NS_Text+26(pc),a0
bsr SI_PrintSize
SETDRMD #RP_JAM2
SETBPEN #7
WRITEMEM #16,#30,#1,NS_Text,#35
move.l Window2(pc),a0 ; wait .....
move.l wd_UserPort(a0),a0
move.l a0,a5
CALLEXEC WaitPort
move.l a5,a0
CALLEXEC GetMsg ; get message
move.l d0,a1
move.l im_Class(a1),d4 ; get data
move.w im_Code(a1),d5
move.l im_IAddress(a1),a4
CALLEXEC ReplyMsg ; reply message
moveq.l #10,d1
CALLDOS_PC Delay
moveq.l #0,d0
move.w gg_GadgetID(a4),d0
cmp.b #3,d0
bhi .Number
cmp.b #1,d0
bne .ChangeSize
move.l Window2(pc),a0
CALLINT_PC CloseWindow
.wait bra wait
.Number lea.l SI_G4_Puffer(pc),a0 ; convert ASCII to hex
bsr GetZahl ; undo if error
move.l d1,d6
tst.l d1
bne.s .W1
move.l d0,Size_Top
.W1 lea.l SI_G5_Puffer(pc),a0
bsr GetZahl
add.l d1,d6
tst.l d1
bne.s .W2
move.l d0,Size_Bottom
.W2 lea.l SI_G6_Puffer(pc),a0
bsr GetZahl
add.l d1,d6
cmp.l #255,d0
bhi.s .W3
tst.l d6
bne.s .W3
move.l d0,Size_Byte
bra .NewSize
.W3 move.l ScreenPtr1(pc),a0 ; error -> undo
CALLINT_PC DisplayBeep
move.l Size_Top(pc),d0
lea.l SI_G4_Puffer(pc),a0
bsr MakeZahl
clr.b (a0)
move.l Size_Bottom,d0
lea.l SI_G5_Puffer(pc),a0
bsr MakeZahl
clr.b (a0)
move.l Size_Byte(pc),d0
lea.l SI_G6_Puffer(pc),a0
bsr MakeHex
clr.b (a0)
lea.l SI_Gadget4(pc),a0
move.l Window2(pc),a1
sub.l a2,a2
CALLINT_PC RefreshGadgets
bra .NewSize
.ChangeSize subq.l #2,d0
move.l d0,.Mode
lea.l SI_G4_Puffer(pc),a0 ; convert ASCII to hex
bsr GetZahl ; go back if error
move.l d1,d6
tst.l d1
bne.s .Z1
move.l d0,Size_Top
.Z1 lea.l SI_G5_Puffer(pc),a0
bsr GetZahl
add.l d1,d6
tst.l d1
bne.s .Z2
move.l d0,Size_Bottom
.Z2 lea.l SI_G6_Puffer(pc),a0
bsr GetZahl
add.l d1,d6
cmp.l #255,d0
bhi .W3
tst.l d6
bne .W3
move.l d0,Size_Byte
move.l Size(pc),d0 ; Does the user really
add.l Size_Top(pc),d0 ; want to create a file
add.l Size_Bottom(pc),d0 ; ( size >0 ) ????
subq.l #1,d0
tst.l d0
bmi .W3 ; NO !!!
move.l Size_Top(pc),d0
neg.l d0
cmp.l Size(pc),d0
bgt .W3
beq .W3
move.l Size_Bottom(pc),d0
neg.l d0
cmp.l Size(pc),d0
bgt .W3
beq .W3
.Z3 move.l Window2(pc),a0
CALLINT_PC CloseWindow
move.l .Mode,d0
tst.l Memory
bne SIZE_RAM
bra wait
.Mode dc.l 0
SI_PrintSize movem.l d0-d7/a0-a5,-(sp)
move.b #" ",d1
tst.l d0
bpl.s SI_PS0
move.b #"-",d1
neg.l d0
SI_PS0 move.b d1,(a0)+
moveq.l #7,d2
moveq.l #0,d3
lea.l SI_Potenzen(pc),a2
SI_PS1 move.b #"0"-1,d1
SI_PS2 addq #1,d1
sub.l (a2),d0
bcc SI_PS2
add.l (a2)+,d0
tst.b d2
beq SI_PS3
cmp.b #"0",d1
beq SI_PS4
moveq.l #1,d3
bra SI_PS3
SI_PS4 tst.b d3
bne SI_PS3
move.b #" ",d1
SI_PS3 move.b d1,(a0)+
dbra d2,SI_PS1
movem.l (sp)+,d0-d7/a0-a5
rts
SI_Potenzen dc.l 10000000
dc.l 1000000
dc.l 100000
dc.l 10000
dc.l 1000
dc.l 100
dc.l 10
dc.l 1
SIZE_RAM tst.l d0 ; change size / edit in RAM
beq .NewFile
move.l Size(pc),d0
add.l Size_Top(pc),d0
add.l Size_Bottom(pc),d0
move.l d0,.NewSize
moveq.l #MEMF_PUBLIC,d1
CALLEXEC AllocMem ; get menory
tst.l d0
bne.s .CS1
bra NoMemory
.CS1 move.l d0,.NewMem ; fill with demanded byte
move.l d0,a0
move.l d0,a1
move.l .NewSize(pc),d1
subq.l #1,d1
.CS2 move.b Size_Byte+3,(a0)+
dbra d1,.CS2
move.l Memory(pc),a0 ; copy it
move.l Size(pc),d1
move.l Size_Top(pc),d0
bpl .CS3
add.l d0,d1
neg.l d0
add.l d0,a0
bra .CS4
.CS3 add.l d0,a1
.CS4 move.l Size_Bottom(pc),d0
tst.l d0
bpl .CS5
add.l d0,d1
.CS5 subq.l #1,d1 ; -> DBRA
.CS6 move.b (a0)+,(a1)+
dbra d1,.CS6
move.l Size(pc),d0 ; free memory used for the old file
move.l Memory(pc),a1
CALLEXEC FreeMem
move.l .NewMem(pc),Memory ; prepare for new file
move.l .NewSize(pc),Size
clr.b FlagWrite
bra NewFile
.NewMem dc.l 0
.NewSize dc.l 0
.File dc.l 0
.Filehandle dc.l 0
.NewFile lea.l .NF_Text(pc),a5 ; save new file
move.l #R_G1,R_def+nw_FirstGadget
bsr FileRequester
tst.l d0
beq wait
move.l d0,.File
move.l #MODE_NEWFILE,d2
move.l d0,d1
CALLDOS_PC Open
tst.l d0
beq OpenError
move.l d0,.Filehandle
move.l Memory(pc),d6
move.l Size(pc),d7
move.l Size_Top(pc),d5
subq.l #1,d5
tst.l d5
bmi .K1
.K0 move.l .Filehandle(pc),d1 ; write bytes at top
moveq.l #1,d3
move.l #Size_Byte+3,d2
CALLDOS_PC Write
cmp.l #1,d0
bne DiskError
dbra d5,.K0
bra.s .K2
.K1 sub.l Size_Top(pc),d6 ; add Size_Top -(-x) = +x
add.l Size_Top(pc),d7
.K2 move.l d6,d2 ; write main part of file
move.l d7,d3
tst.l Size_Bottom
bpl.s .K3
add.l Size_Bottom(pc),d3
.K3 move.l d3,d5
move.l .Filehandle(pc),d1
CALLDOS_PC Write
cmp.l d5,d0
bne DiskError
move.l Size_Bottom(pc),d5
subq.l #1,d5
tst.l d5
bmi .K4
.K5 move.l .Filehandle(pc),d1 ; write bytes at bottom
moveq.l #1,d3
move.l #Size_Byte+3,d2
CALLDOS_PC Write
cmp.l #1,d0
bne DiskError
dbra d5,.K5
.K4 move.l .Filehandle(pc),d1
CALLDOS_PC Close
.wait bra wait
.NF_Text dc.b " Save File With New Size : "
even
****************************
SaveQuestion move.l (sp)+,.Return
tst.b FlagFile ; ask if you want to save file
beq .wait
tst.l Memory ; have you change anything or
beq .wait ; do you edit on device ?
tst.b FlagWrite
beq .wait
lea.l Windowdef3(pc),a0
bsr MakeWindow
tst.l d0
beq .wait
move.l d0,Window2
SETDRMD #RP_JAM1
WRITE #6+(290-23*8)/2,#19,#0,<"Do you want to save the">
WRITE #6+(290-6*8)/2,#19+15,#0,<"file ?">
WRITE #5+(290-23*8)/2,#18,#1,<"Do you want to save the">
WRITE #5+(290-6*8)/2,#18+15,#1,<"file ?">
.WAIT move.l Window2(pc),a0 ; wait .....
move.l wd_UserPort(a0),a0
move.l a0,a5
CALLEXEC WaitPort
move.l a5,a0
CALLEXEC GetMsg ; get message
move.l d0,a1
move.l im_Class(a1),d4 ; get data
move.w im_Code(a1),d5
move.l im_IAddress(a1),a4
CALLEXEC ReplyMsg ; reply message
moveq.l #0,d0
cmp.l #VANILLAKEY,d4
beq.s .Key
move.l Window2(pc),a0
CALLINT_PC CloseWindow
moveq.l #0,d0
move.w gg_GadgetID(a4),d0
bra .Label1
.Key cmp.b #"y",d5
beq.s .Yes ; yes
cmp.b #"Y",d5
beq.s .Yes ; yes
cmp.b #"N",d5
beq.s .No
cmp.b #"n",d5
bne .WAIT
.No moveq.l #10,d1
CALLDOS_PC Delay
move.l Window2(pc),a0
CALLINT_PC CloseWindow
moveq.l #1,d0
bra .Label1
.Yes moveq.l #10,d1
CALLDOS_PC Delay
move.l Window2(pc),a0
CALLINT_PC CloseWindow
moveq.l #0,d0
.Label1 tst.b d0
bne .wait
lea.l SAVE_Text(pc),a5 ; Save file
move.l #R_G1,R_def+nw_FirstGadget
bsr FileRequester
tst.l d0
beq .wait
move.l d0,.File
move.l .File(pc),d1 ; Copy file from RAM to device
move.l #MODE_NEWFILE,d2
CALLDOS_PC Open
tst.l d0
beq OpenError
move.l d0,Filehandle
move.l d0,d1
move.l Size(pc),d3
move.l Memory(pc),d2
CALLDOS_PC Write
cmp.l Size(pc),d0
bne DiskError
move.l Filehandle(pc),d1
CALLDOS_PC Close
clr.b FlagWrite
.wait move.l .Return(pc),a0
jmp (a0)
.Return dc.l 0
.File dc.l 0
***************************
ChangeWrite move.b d0,WriteMode ; change write mode flag
tst.b d0
beq.s .Q1
bclr.b #0,M1_I3_Sub1+mi_Flags
.Q1 cmp.b #1,d0
beq.s .Q2
bclr.b #0,M1_I3_Sub2+mi_Flags
.Q2 cmp.b #2,d0
beq.s .Q3
bclr.b #0,M1_I3_Sub3+mi_Flags
.Q3 bra wait
************************************
PrefName dc.b "DEVS:FileMaster.Pref",0
even
GetPrefs lea.l PrefName+5(pc),a0 ; current dir
move.l a0,d1 ; load preferences
move.l #MODE_OLDFILE,d2 ; if available in
CALLDOS_PC Open ; the current dir
tst.l d0
beq.s .Try_DEVS
move.l d0,d1
move.l d0,d6
move.l #PrefSize,d3
move.l #PREFS,d2
CALLDOS_PC Read
move.l d6,d1
CALLDOS_PC Close
rts
.Try_DEVS lea.l PrefName(pc),a0 ; DEVS:
move.l a0,d1 ; load preferences
move.l #MODE_OLDFILE,d2 ; if available in
CALLDOS_PC Open ; the current dir
tst.l d0
beq.s .L1
move.l d0,d1
move.l d0,d6
move.l #PrefSize,d3
move.l #PREFS,d2
CALLDOS_PC Read
move.l d6,d1
CALLDOS_PC Close
.L1 rts
************************************
SavePrefs move.b d0,d6
move.l Window1,a0 ; save preferences
CALLINT_PC ViewPortAddress ; copy colours
move.l d0,a0
move.l vp_ColorMap(a0),a0
move.l cm_ColorTable(a0),a0
lea.l PREFS,a1
moveq.l #7,d0
.L0 move.w (a0)+,(a1)+
dbra d0,.L0
lea.l PrefName(pc),a0
move.l a0,d1
tst.b d6 ; current dir or DEVS:
bne.s .Devs
addq.l #5,d1 ; skip "DEVS:"
.Devs move.l #MODE_NEWFILE,d2
CALLDOS_PC Open
tst.l d0
beq OpenError
move.l d0,d1
move.l d0,d6
move.l #PrefSize,d3
move.l #PREFS,d2
CALLDOS_PC Write
cmp.l d3,d0
bne .DiskError
move.l d6,d1
CALLDOS_PC Close
.L1 bra wait
.DiskError move.l d6,d1
CALLDOS_PC Close
bra OpenError
************************************
DefaultPrefs lea.l PREFS,a0 ; use default prefs
lea.l DPrefs,a1
move.w #PrefSize-1,d0
.L1 move.b (a1)+,(a0)+
dbra d0,.L1
move.l Window1,a0 ; set colours
CALLINT_PC ViewPortAddress
move.l d0,a0
move.l #16,d0
lea.l Palette,a1
CALLGRAF_PC LoadRGB4
CALLINT_PC RemakeDisplay
move.b WriteMode,d0 ; set marks
bset.b #0,M1_I3_Sub1+mi_Flags
bset.b #0,M1_I3_Sub2+mi_Flags
bset.b #0,M1_I3_Sub3+mi_Flags
tst.b d0
beq.s .Q1
bclr.b #0,M1_I3_Sub1+mi_Flags
.Q1 cmp.b #1,d0
beq.s .Q2
bclr.b #0,M1_I3_Sub2+mi_Flags
.Q2 cmp.b #2,d0
beq.s .Q3
bclr.b #0,M1_I3_Sub3+mi_Flags
.Q3 jsr Hardcopy_Gadgets
lea.l M1_I6_String+12(pc),a0
move.b DriveName+2,(a0)
move.b Joker,JoString+12 ; copy joker to menu
bra wait
*************************************
*
* who's the author of File Master ?????
*
WindowPointer set Window2
Windowdef6 dc.w 50,34,350,150
dc.b -1,-1
dc.l GADGETUP!VANILLAKEY
dc.l ACTIVATE!SMART_REFRESH!RMBTRAP
dc.l .Gadget1
dc.l 0
dc.l 0
dc.l 0,0
dc.w 0,0,0,0,CUSTOMSCREEN
.Gadget1 FM_GADGET 0,150,130,50,0,<"OK">,1,4
ABOUT jsr INFO
bra wait
INFO lea.l Windowdef6(pc),a0
bsr MakeWindow
tst.l d0
beq .wait
move.l d0,Window2
move.l d0,a0
move.l wd_RPort(a0),a0
lea.l FM_LOGO,a1
moveq.l #4,d1
move.l #(350-241)/2,d0
CALLINT_PC DrawImage
SETDRMD #RP_JAM1
WRITE #6+(340-41*8)/2,#36+5,#0,<"Source 238 / Release 1.2 / Date 1.04.90">
WRITE #6+(340-24*8)/2,#51+5,#0,<"© by ROGER FISCHLIN ">
WRITE #6+(340-24*8)/2,#61+5,#0,<" STEIGERWALDWEG 6">
WRITE #6+(340-24*8)/2,#71+5,#0,<" D-6450 HANAU 7 ">
WRITE #6+(340-24*8)/2,#81+5,#0,<" WEST GERMANY ">
WRITE #6+(340-24*8)/2,#91+5,#0,<"Phone : (06181) 650266">
WRITE #6+(340-42*8)/2,#106+5,#0,<"This program is SHAREWARE - if you use it,">
WRITE #6+(340-42*8)/2,#116+5,#0,<"please send me US $10 (or DM 10 only EEC).">
WRITE #5+(340-41*8)/2,#35+5,#5,<"Source 238 / Release 1.2 / Date 1.04.90">
WRITE #5+(340-24*8)/2,#50+5,#1,<"© by ROGER FISCHLIN ">
WRITE #5+(340-24*8)/2,#60+5,#1,<" STEIGERWALDWEG 6">
WRITE #5+(340-24*8)/2,#70+5,#1,<" D-6450 HANAU 7 ">
WRITE #5+(340-24*8)/2,#80+5,#1,<" WEST GERMANY ">
WRITE #5+(340-24*8)/2,#90+5,#1,<"Phone : (06181) 650266">
WRITE #5+(340-42*8)/2,#105+5,#5,<"This program is SHAREWARE - if you use it,">
WRITE #5+(340-42*8)/2,#115+5,#5,<"please send me US $10 (or DM 10 only EEC).">
move.l Window2,a0
move.l wd_UserPort(a0),a0
move.l a0,a5
CALLEXEC WaitPort
move.l Window2,a0
CALLINT_PC CloseWindow
.wait rts
****************************************
*
* search (HEX or ASCII)
*
WindowPointer set Window2
Windowdef7 dc.w 40,36,370,140
dc.b -1,-1
dc.l GADGETUP!GADGETDOWN
dc.l ACTIVATE!SMART_REFRESH!RMBTRAP
dc.l SE_Gadget1
dc.l 0
dc.l 0
dc.l 0,0
dc.w 0,0,0,0,CUSTOMSCREEN
SE_Gadget1 FM_GADGET SE_Gadget2,10,120,110,1,<"Cancel">,1,2
SE_Gadget2 FM_GADGET SE_Gadget3,130,120,110,2,<"Search ASCII">,1,2
SE_Gadget3 FM_GADGET SE_Gadget4,250,120,110,3,<"Search HEX">,1,2
SE_Gadget4 FM_GADGET SE_Gadget5,210,50,70,4,<"First">,1,4
SE_Gadget5 FM_GADGET SE_Gadget6,290,50,70,5,<"Last">,1,4
SE_Gadget6 FM_GADGET SE_Gadget7,210,70,70,6,<"Yes">,1,4
SE_Gadget7 FM_GADGET SE_Gadget8,290,70,70,7,<"No">,1,4
SE_Gadget8 FM_GADGET SE_Gadget9,210,90,70,8,<"Forward">,1,4
SE_Gadget9 FM_GADGET SE_Gadget10,290,90,70,9,<"Backward">,1,4
SE_Gadget10 dc.l SE_Gadget11
dc.w 11,30+1,43*8,10,GADGHCOMP,STRINGCENTER,STRGADGET
dc.l SE_G10_Box,0,0,0,SE_G10_Info
dc.w 10,0,0
SE_G10_Box BOX -1,-1,344,8,2,SE_G10_Box2
SE_G10_Box2 BOX -2,-2,345,9,1,0
SE_G10_Info dc.l SE_G10_Puffer,SE_G10_Undo
dc.w 0,44
ds.w 12
SE_G10_Puffer ds.b 50
SE_G10_Undo ds.b 50
SE_Gadget11 dc.l 0
dc.w 130,50+2,64,10,GADGHCOMP,RELVERIFY,STRGADGET
dc.l SE_G11_Box,0,0,0,SE_G11_Info
dc.w 11,0,0
SE_G11_Box BOX -1,-1,64,8,2,SE_G11_Box2
SE_G11_Box2 BOX -2,-2,65,9,1,0
SE_G11_Info dc.l SE_G11_Puffer,SE_G11_Undo
dc.w 0,10
ds.w 12
SE_G11_Puffer ds.b 20
SE_G11_Undo ds.b 20
Xwait jmp wait
SEARCH tst.b FlagFile ; have you already opened a file ?
beq.s Xwait
move.w #GADGIMMEDIATE,d0
move.w d0,SE_Gadget4+gg_Activation ; modify gadgets
move.w d0,SE_Gadget5+gg_Activation
move.w d0,SE_Gadget6+gg_Activation
move.w d0,SE_Gadget7+gg_Activation
move.w d0,SE_Gadget8+gg_Activation
move.w d0,SE_Gadget9+gg_Activation
move.l Offset,d0
divu #512,d0
and.l #$ffff,d0
addq #1,d0
move.l d0,SearchSector
lea.l SE_G11_Puffer(pc),a0
bsr MakeZahl
clr.b (a0)
clr.l SearchPos
lea.l Windowdef7(pc),a0
bsr MakeWindow
tst.l d0
beq.s Xwait
move.l d0,Window2
SETDRMD #RP_JAM1
WRITE #6+(370-8*8)/2,#11,#0,<"Search :">
WRITE #5+(370-8*8)/2,#10,#1,<"Search :">
WRITE #10,#58,#1,<"Sector :">
WRITE #10,#78,#1,<"Case sensitiv:">
WRITE #10,#98,#1,<"Direction :">
S_NewPref SETDRMD #RP_JAM2 ; write input
SETBPEN #7
tst.l SearchCase
bne.s .L1
WRITE #130,#78,#5,<"yes">
bra.s .L2
.L1 WRITE #130,#78,#5,<"no ">
.L2 tst.l SearchDirection
bmi.s .L3
WRITE #130,#98,#5,<"forward ">
bra.s .L4
.L3 WRITE #130,#98,#5,<"backward">
.L4 lea.l SE_Gadget11(pc),a0
move.l WindowPointer,a1
sub.l a2,a2
CALLINT_PC RefreshGadgets
lea.l SE_Gadget10(pc),a0
move.l WindowPointer,a1
sub.l a2,a2
CALLINT_PC ActivateGadget
.Message move.l Window2,a0 ; wait .....
move.l wd_UserPort(a0),a0
move.l a0,a5
CALLEXEC WaitPort
move.l a5,a0
CALLEXEC GetMsg ; get message
move.l d0,a1
move.l im_Class(a1),d4 ; get data
move.w im_Code(a1),d5
move.l im_IAddress(a1),a4
CALLEXEC ReplyMsg ; reply message
moveq.l #0,d0
move.w gg_GadgetID(a4),d0
cmp.b #3,d0
bls .Goon
cmp.b #6,d0
beq .YES
cmp.b #7,d0
beq .NO
cmp.b #8,d0
beq .FORWARD
cmp.b #9,d0
beq .BACKWARD
cmp.b #4,d0
beq .FIRST
cmp.b #5,d0
beq .LAST
cmp.b #11,d0
beq .Sector
bra .Message
.YES clr.l SearchCase
bra S_NewPref
.NO move.l #1,SearchCase
bra S_NewPref
.FORWARD move.l #1,SearchDirection
bra S_NewPref
.BACKWARD move.l #-1,SearchDirection
bra S_NewPref
.FIRST move.w #$3100,SE_G11_Puffer
move.l #1,SearchSector
bra S_NewPref
.LAST move.l Size,d0
divu #512,d0
move.l d0,d1
swap d1
and.l #$ffff,d0
tst.w d1
beq.s .SN1
addq #1,d0
.SN1 move.l d0,SearchSector
lea.l SE_G11_Puffer(pc),a0
bsr MakeZahl
clr.b (a0)
bra S_NewPref
.Sector lea.l SE_G11_Puffer(pc),a0
bsr GetZahl
tst.l d0
beq .Q2
tst.l d1
beq .Q1
.Q2 move.l ScreenPtr1,a0
CALLINT_PC DisplayBeep
move.l SearchSector(pc),d0
lea.l SE_G11_Puffer(pc),a0
bsr MakeZahl
clr.b (a0)
bra S_NewPref
.Q1 move.l d0,d1
subq.l #1,d1
mulu #512,d1
cmp.l Size,d1
bge.s .Q2
move.l d0,SearchSector
bra .Message
.Goon cmp.b #2,d0
beq SearchString
cmp.b #3,d0
beq SearchHex
moveq.l #10,d1
CALLDOS_PC Delay
move.l Window2,a0
CALLINT_PC CloseWindow
moveq.l #0,d0
move.w gg_GadgetID(a4),d0
.wait jmp wait
SearchSector dc.l 0
SearchDirection
dc.l 1
SearchCase dc.l 0
SearchMode dc.l -1
**************************************
SearchHex and.l #$ff,d0
move.l d0,SearchMode
lea.l SE_G11_Puffer(pc),a0 ; check sector
bsr GetZahl
tst.l d0
beq .D2
tst.l d1
beq .Q1
.D2 move.l ScreenPtr1,a0
CALLINT_PC DisplayBeep
move.l SearchSector(pc),d0
lea.l SE_G11_Puffer(pc),a0
bsr MakeZahl
clr.b (a0)
bra S_NewPref
.Q1 move.l d0,d1
subq.l #1,d1
mulu #512,d1
cmp.l Size,d1
bge.s .Q2
move.l d0,SearchSector
lea.l SE_G10_Puffer(pc),a0
lea.l CompPuffer,a1
clr.b (a1)
.Q2 move.b (a0)+,d0 ; skip all spaces and $
tst.b d0
beq .Q4
cmp.b #" ",d0
beq.s .Q2
cmp.b #"$",d0
beq.s .Q2
move.b d0,d2 ; joker ?
cmp.b Joker,d0
beq .W5
lea.l .Hex(pc),a2 ; ASCII -> Hex
moveq.l #-1,d2 ; get 1. nibble
.W3 addq.l #1,d2
cmp.l #32,d2
bhi .Error
cmp.b (a2)+,d0
bne.s .W3
and.l #$f,d2
move.b (a0)+,d0
lea.l .Hex(pc),a2 ; ASCII -> Hex
moveq.l #-1,d3 ; get 2. nibble
.W4 addq.l #1,d3
cmp.l #32,d3
bhi .Error
cmp.b (a2)+,d0
bne.s .W4
and.l #$f,d3
lsl.b #4,d2
or.b d3,d2
.W5 move.b d2,(a1)+ ; copy to buffer
bra .Q2
.Q4 move.l a1,d0 ; get length
sub.l #CompPuffer,d0
move.l d0,SearchLength
tst.l d0
beq .Q2
move.l Window2,a0
CALLINT_PC CloseWindow
bra J
.Error move.l ScreenPtr1,a0
CALLINT_PC DisplayBeep
bra S_NewPref
.Hex dc.b "0123456789abcdef"
dc.b "0123456789ABCDEF"
***************************************
SearchString and.l #$ff,d0
move.l d0,SearchMode
lea.l SE_G11_Puffer(pc),a0 ; check sector
bsr GetZahl
tst.l d0
beq .Q2
tst.l d1
beq .Q1
.Q2 move.l ScreenPtr1,a0
CALLINT_PC DisplayBeep
move.l SearchSector(pc),d0
lea.l SE_G11_Puffer(pc),a0
bsr MakeZahl
clr.b (a0)
bra S_NewPref
.Q1 move.l d0,d1
subq.l #1,d1
mulu #512,d1
cmp.l Size,d1
bge.s .Q2
move.l d0,SearchSector
lea.l SE_G10_Puffer(pc),a0 ; get length
lea.l CompPuffer,a1
moveq.l #-1,d0
moveq.l #0,d1
.Q3 addq.l #1,d0
moveq.l #0,d1
move.b (a0)+,d1
tst.b d1
beq .Q3a
jsr UPCASE_D1
.Q3b move.b d1,(a1)+
bra .Q3
.Q3a move.l d0,SearchLength
tst.l d0
beq .Q2
move.l Window2,a0
CALLINT_PC CloseWindow
J bsr Search_OpenWindow
.E1 move.l SearchSector(pc),d0
tst.l d0 ; reached EOF ?
beq .NotFound
move.l d0,d1
subq.l #1,d1
mulu #512,d1
cmp.l Size,d1
bge .NotFound
bsr GetSearchSector ; get sector
tst.l d0 ; error ?
bne .DiskError
bsr Search_Update ; write new sector number, check if user break
tst.l d0
bne .Cancel
bsr Search_it ; search it
tst.l d0 ; found it ?
bne FOUND
move.l SearchSector(pc),d0
add.l SearchDirection(pc),d0
move.l d0,SearchSector
bra .E1
.NotFound bsr Search_CloseWindow
bra NotFound
.DiskError bsr Search_CloseWindow
bra OpenError
.Cancel bsr Search_CloseWindow
jmp wait
FOUND bsr Search_CloseWindow
lea.l SearchPufferII+64,a0 ; show sector
lea.l Puffer,a1
lea.l UndoPuffer,a2
move.w #511,d0
.L0 move.b (a0),(a1)+
move.b (a0)+,(a2)+
dbra d0,.L0
move.l SearchSector(pc),d1
subq.l #1,d1
mulu #512,d1
move.l Size,d0
sub.l d1,d0
cmp.l #512,d0
bls .L3
move.l #512,d0
.L3 move.l d0,AnzahlBytes
move.l d1,Offset
bsr SectorNumber
bsr ShowPuffer
lea.l Color,a0
lea.l SearchColors+64,a1
move.w #511,d0
.L1 move.b (a1)+,(a0)+
dbra d0,.L1
WindowPointer set Window1
SETAPEN #4
moveq.l #0,d0 ; show strings
lea.l Color,a0
.Z1 cmp.b #4,(a0)+
bne.s .Z2
movem.l d0/a0,-(sp)
bsr PutCursor
movem.l (sp)+,d0/a0
.Z2 addq.l #1,d0
cmp.l AnzahlBytes,d0
bne.s .Z1
lea.l Color,a0 ; put cursor to first byte
moveq.l #-1,d0
.Z4 addq.l #1,d0
cmp.l #511,d0
beq .Z5
cmp.b #4,(a0)+
bne.s .Z4
move.l #1,Cursor
bsr SetCursor
jmp NewPos
.Z5 move.l #1,Cursor
moveq.l #0,d0
bsr SetCursor
jmp NewPos
GetSearchSector
move.l d0,-(sp) ; get sector
move.b CompPuffer,d1 ; and some bytes of the
eor.b #$ff,d1 ; previous sector and
move.w #1023,d2 ; the next sector
lea.l SearchColors,a0
lea.l SearchPuffer,a1 ; fill buffer with
.G1 move.b d1,(a1)+ ; different byte
move.b #3,(a0)+
dbra d2,.G1
move.l (sp)+,d3
subq.l #1,d3
mulu #512,d3
sub.l #64,d3 ; get 64 bytes of previous sector
move.l #SearchPuffer,d4
tst.l d3 ; first sector -> no bytes from previous sector
bpl .G2
add.l #64,d4
add.l #64,d3
.G2 move.l d3,d5
add.l #512+64+64,d5 ; d3 = offset
cmp.l Size,d5 ; d4 = ^buffer
bls .G3 ; d5 = length
move.l Size,d5
.G3 sub.l d3,d5
tst.l Memory
beq .Device
move.l d4,a1
move.l Memory,a0
add.l d3,a0
subq.l #1,d5
.G4 move.b (a0)+,(a1)+
dbra d5,.G4
.G6a lea.l SearchPuffer,a0
lea.l SearchPufferII,a1
move.w #1023,d0
.O1 move.b (a0)+,(a1)+
dbra d0,.O1
.G6 cmp.l #3,SearchMode
beq.s .G7
tst.l SearchCase
beq.s .G7
lea.l SearchPuffer,a0 ; Upcase
move.w #512+64+64-1,d0
.G8 move.b (a0)+,d1
jsr UPCASE_D1
move.b d1,-1(a0)
.G9 dbra d0,.G8
.G7 moveq.l #0,d0
rts
.Device move.l d3,d2 ; get sector from device
move.l Filehandle,d1
moveq.l #OFFSET_BEGINNING,d3
CALLDOS_PC Seek
move.l Filehandle,d1
move.l d4,d2
move.l d5,d3
CALLDOS_PC Read
cmp.l d5,d0
beq .G6a
moveq.l #-1,d0
rts
****************************************
* search it !!!
Search_it move.l #512+64+64-1,d0
lea.l SearchPuffer,a0
lea.l SearchColors,a1
.W1 move.l a0,a3 ; compare
move.l a1,a4
lea.l CompPuffer,a2
move.l SearchLength(pc),d1
subq.l #1,d1
.W3 move.b (a2)+,d3
move.b (a3)+,d4
cmp.l #3,SearchMode ; if you search for hex
beq.s .W10 ; don't compare to joker
cmp.b Joker,d3
beq.s .W5
.W10 cmp.b d3,d4
bne .W2
.W5 dbra d1,.W3
move.l SearchLength(pc),d1 ; found it !!!
subq.l #1,d1
.W4 move.b #4,(a4)+
dbra d1,.W4
.W2 tst.b (a1)+
tst.b (a0)+
dbra d0,.W1
moveq.l #0,d2
lea.l SearchColors+64,a0
move.l #511,d0
.W6 cmp.b #4,(a0)+
bne.s .W7
moveq.l #1,d2
.W7 dbra d0,.W6
move.l d2,d0
rts
SearchPos dc.l 0
SearchLength dc.l 0
************************************
*
* continue searching (forward)
*
NEXT tst.b FlagFile ; file opened ?
beq.s .nothing
tst.l SearchLength ; Have you entered a search string ?
beq.s .nothing
move.l #1,SearchDirection ; forward
move.l Offset,d0 ; start with current sector
divu #512,d0 ; except File Master just
and.l #$ffff,d0 ; found it on that sector
addq.l #1,d0
cmp.l SearchSector(pc),d0
bne.s .W1
add.l SearchDirection(pc),d0
.W1 move.l d0,SearchSector
bra J
.nothing jmp wait
************************************
*
* continue searching (backward)
*
PREVIOUS tst.b FlagFile ; file opened ?
beq.s .nothing
tst.l SearchLength ; Have you entered a search string ?
beq.s .nothing
move.l #-1,SearchDirection ; backward
move.l Offset,d0 ; start with current sector
divu #512,d0 ; except File Master just
and.l #$ffff,d0 ; found it on that sector
addq.l #1,d0
cmp.l SearchSector(pc),d0
bne.s .W1
add.l SearchDirection(pc),d0
.W1 move.l d0,SearchSector
bra J
.nothing jmp wait
************************************
WindowPointer set Window2
NotFound move.l Offset,d0 ; next time : start with current sector
divu #512,d0 ;
and.l #$ffff,d0 ;
addq.l #1,d0
move.l d0,SearchSector
move.l ScreenPtr1,a0
CALLINT_PC DisplayBeep
lea.l Windowdef2,a0
jsr MakeWindow
tst.l d0
beq .wait
move.l d0,Window2
SETDRMD #RP_JAM1
WRITE #6+(290-11*8)/2,#19+10,#0,<"Not found !">
WRITE #5+(290-11*8)/2,#18+10,#1,<"Not found !">
move.l Window2,a0
move.l wd_UserPort(a0),a0
move.l a0,a5
CALLEXEC WaitPort
move.l Window2,a0
CALLINT_PC CloseWindow
.wait jmp wait
**************************************************
*
* Search window
*
WindowPointer set Window2
Windowdef8 dc.w 60,50,300,70
dc.b -1,-1
dc.l GADGETUP!RAWKEY
dc.l ACTIVATE!SMART_REFRESH!RMBTRAP
dc.l .Gadget1
dc.l 0
dc.l 0
dc.l 0,0
dc.w 0,0,0,0,CUSTOMSCREEN
.Gadget1 FM_GADGET 0,110,50,80,0,<"Cancel">,1,4
Search_OpenWindow
lea.l Windowdef8(pc),a0
jsr MakeWindow
move.l d0,Window2
tst.l d0
beq .NoWindow
SETDRMD #RP_JAM1
WRITE #6+(290-25*8)/2,#19,#0,<"Searching - please wait !">
WRITE #5+(290-25*8)/2,#18,#1,<"Searching - please wait !">
SETDRMD #RP_JAM2
SETBPEN #7
.NoWindow rts
Search_Update move.l Window2,d0 ; write new sector number
tst.l d0
beq .NoWindow
move.l #$20202020,SSector_text+10
move.b #" ",SSector_text+9
lea.l SSector_text+9(pc),a0
move.l SearchSector(pc),d0
jsr MakeZahl
WRITEMEM #5+(290-11*8)/2,#35,#1,SSector_text,#15
move.l Window2,a0 ; user break ??
move.l wd_UserPort(a0),a0
CALLEXEC GetMsg
tst.l d0
beq .NoWindow
move.l d0,a1
CALLEXEC ReplyMsg
moveq.l #1,d0
.NoWindow rts
even
SSector_text dc.b "sector : ..... "
Search_CloseWindow ; close window
tst.l Window2
beq .NoWindow
moveq.l #10,d1
CALLDOS Delay
move.l Window2,a0
CALLINT_PC CloseWindow
.NoWindow rts
**************************************************
ChangeDisplay move.b d0,DisplayMode ; change Display (replace ASCII with ".")
jsr ShowPuffer
move.l Cursor,-(sp)
lea.l Color,a5
moveq.l #0,d7
.K1 cmp.b #3,(a5)+
beq .K2
movem.l d7/a5,-(sp)
move.l d7,d0
jsr SetCursor
movem.l (sp)+,d7/a5
.K2 addq.l #1,d7
cmp.l #512,d7
bne.s .K1
move.l (sp)+,d0
jsr SetCursor
jmp wait
**************************************************
NEWCLI move.l #Nil,d1
move.l #1005,d2
CALLDOS_PC Open
tst.l d0
beq.s .wait
move.l d0,d2
move.l d0,d3
move.l #NC,d1
CALLDOS_PC Execute
tst.l d0
bpl.s .wait
CALLINT_PC WBenchToFront
.wait jmp wait
even
NC dc.b "newcli",0
even
Nil dc.b "NIL:",0
even
************************************************
NEWSHELL move.l #Nil,d1
move.l #1005,d2
CALLDOS_PC Open
tst.l d0
beq.s .wait
move.l d0,d2
move.l d0,d3
move.l #ns,d1
CALLDOS_PC Execute
tst.l d0
bpl.s NEWCLI
CALLINT_PC WBenchToFront
.wait jmp wait
even
ns dc.b "newshell",0
even
*************************************************
* which Amiga ( PAL / NTSC ) are you using ???
PAL_NTSC move.l 4,a6
cmp.b #50,VBlankFrequency(a6)
bne.s NTSC_AMIGA
move.l #FONT_PAL1,FM_Font
rts
NTSC_AMIGA move.l #FONT_NTSC1,FM_Font
move.w #207,Windowdef1+nw_Height
move.w #207,Screendef+ns_Height
lea.l NTSC,a0
lea.l PAL,a1
move.l #PAL_end-PAL-1,d0
.Q1 move.b (a0)+,(a1)+
dbra d0,.Q1
rts
**********************************************
*
* how much memory is available ???
*
WindowPointer set Window2
Windowdef9 dc.w 60,50,300,100
dc.b -1,-1
dc.l GADGETUP!VANILLAKEY
dc.l ACTIVATE!SMART_REFRESH!RMBTRAP
dc.l .Gadget1
dc.l 0
dc.l 0
dc.l 0,0
dc.w 0,0,0,0,CUSTOMSCREEN
.Gadget1 FM_GADGET 0,125,80,50,0,<"OK">,1,4
MEMORY lea.l Windowdef9(pc),a0
jsr MakeWindow
tst.l d0
beq .wait
move.l d0,Window2
SETDRMD #RP_JAM1
WRITE #6+(290-6*8)/2,#19,#0,<"Memory">
WRITE #5+(290-6*8)/2,#18,#1,<"Memory">
moveq.l #MEMF_PUBLIC,d1
CALLEXEC AvailMem
lea.l Mem_text1+48-32(pc),a0
jsr MakeMZahl
moveq.l #MEMF_CHIP,d1
CALLEXEC AvailMem
lea.l Mem_text2+48-32(pc),a0
jsr MakeMZahl
moveq.l #MEMF_FAST,d1
CALLEXEC AvailMem
lea.l Mem_text3+48-32(pc),a0
jsr MakeMZahl
move.l #MEMF_PUBLIC!MEMF_LARGEST,d1
CALLEXEC AvailMem
lea.l Mem_text1+58-32(pc),a0
jsr MakeMZahl
move.l #MEMF_CHIP!MEMF_LARGEST,d1
CALLEXEC AvailMem
lea.l Mem_text2+58-32(pc),a0
jsr MakeMZahl
move.l #MEMF_FAST!MEMF_LARGEST,d1
CALLEXEC AvailMem
lea.l Mem_text3+58-32(pc),a0
jsr MakeMZahl
WRITEMEM #5+(290-34*8)/2,#40,#1,Mem_text1,#34
WRITEMEM #5+(290-34*8)/2,#50,#1,Mem_text2,#34
WRITEMEM #5+(290-34*8)/2,#60,#1,Mem_text3,#34
move.l Window2,a0
move.l wd_UserPort(a0),a0
move.l a0,a5
CALLEXEC WaitPort
move.l Window2,a0
CALLINT_PC CloseWindow
.wait jmp wait
Mem_text1 dc.b "Public memory : ........ /........"
even
Mem_text2 dc.b "CHIP memory : ........ /........"
even
Mem_text3 dc.b "FAST memory : ........ /........"
even
MakeMZahl movem.l d0-d7/a1-a5,-(sp) ; convert d0 into ASCII (a0 ^buffer)
tst.l d0
moveq.l #7,d2
moveq.l #0,d3
lea.l .MZ_Potenzen(pc),a2
.MZ1 move.b #"0"-1,d1
.MZ2 addq #1,d1
sub.l (a2),d0
bcc.s .MZ2
add.l (a2)+,d0
tst.b d2
beq.s .MZ3
cmp.b #"0",d1
beq.s .MZ4
moveq.l #1,d3
bra.s .MZ3
.MZ4 tst.b d3
bne.s .MZ3
move.b #" ",d1
.MZ3 move.b d1,(a0)+
dbra d2,.MZ1
movem.l (sp)+,d0-d7/a1-a5
rts
.MZ_Potenzen dc.l 10000000
dc.l 1000000
dc.l 100000
dc.l 10000
dc.l 1000
dc.l 100
dc.l 10
dc.l 1
**********************************************
*
* Enter new joker
*
WindowPointer set Window2
Windowdef10 dc.w 60,50,300,70
dc.b -1,-1
dc.l GADGETUP
dc.l ACTIVATE!SMART_REFRESH!RMBTRAP
dc.l JO_Gadget1
dc.l 0
dc.l 0
dc.l 0,0
dc.w 0,0,0,0,CUSTOMSCREEN
JO_Gadget1 FM_GADGET JO_Gadget2,50,50,60,1,<"OK">,1,4
JO_Gadget2 FM_GADGET JO_Gadget3,200,50,60,0,<"Cancel">,1,4
JO_Gadget3 dc.l 0
dc.w (300-24)/2,30,24,10,GADGHCOMP,RELVERIFY,STRGADGET
dc.l JO_G3_Box,0,0,0,JO_G3_Info
dc.w 3,0,0
JO_G3_Box BOX -1,-1,24,8,2,JO_G3_Box2
JO_G3_Box2 BOX -2,-2,25,9,1,0
JO_G3_Info dc.l JO_G3_Puffer,JO_G3_Undo
dc.w 0,4
ds.w 12
JO_G3_Puffer ds.b 6
JO_G3_Undo ds.b 6
NewJoker lea.l JO_G3_Puffer(pc),a0
move.b Joker,(a0)+
clr.b (a0)
lea.l Windowdef10(pc),a0
jsr MakeWindow
tst.l d0
beq .K3
move.l d0,Window2
SETDRMD #RP_JAM1
WRITE #6+(290-15*8)/2,#19,#0,<"Enter new joker">
WRITE #5+(290-15*8)/2,#18,#1,<"Enter new joker">
.wait lea.l JO_Gadget3(pc),a0
move.l Window2,a1
sub.l a2,a2
CALLINT_PC ActivateGadget
move.l Window2,a0 ; wait .....
move.l wd_UserPort(a0),a0
move.l a0,a5
CALLEXEC WaitPort
move.l a5,a0
CALLEXEC GetMsg ; get message
move.l d0,a1
move.l im_Class(a1),d4 ; get data
move.w im_Code(a1),d5
move.l im_IAddress(a1),a4
CALLEXEC ReplyMsg ; reply message
cmp.w #1,gg_GadgetID(a4)
beq .K1
tst.b JO_G3_Puffer ; check if correct (no " " , no "$")
beq.s .K2
cmp.b #" ",JO_G3_Puffer
beq.s .K2
cmp.b #"$",JO_G3_Puffer
beq.s .K2
tst.b JO_G3_Puffer+1 ; correct size (1)
bne.s .K2
jmp .K1
.K2 move.l ScreenPtr1,a0
CALLINT_PC DisplayBeep
lea.l JO_G3_Puffer(pc),a0
move.b Joker,(a0)+
clr.b (a0)
bra .wait
.K1 moveq.l #10,d1
CALLDOS_PC Delay
move.l Window2,a0
CALLINT_PC CloseWindow
moveq.l #0,d0
move.w gg_GadgetID(a4),d0
cmp.b #1,d0
beq.s .K3
move.b JO_G3_Puffer(pc),Joker ; copy new joker
move.b JO_G3_Puffer(pc),JoString+12
moveq.l #10,d1
CALLDOS_PC Delay
.K3 jmp wait
**********************************************
Exec_Puffer1 ds.b 44
Exec_Puffer2 dc.b ":",0
ds.b 302
Exec_File dc.l 0
Exec_Filehandle dc.l 0
Exec_Memory dc.l 0
Exec_Size dc.l 0
Exec_Seek dc.l 0
EXECUTE tst.b FlagFile
beq .wait
move.l #1,R_Read ; don't display old file list
lea.l Exec_Puffer1(pc),a0 ; exchange file name and drawer
lea.l R_File,a1
move.l #43,d0
.L1 move.b (a1),d1
move.b (a0),(a1)+
move.b d1,(a0)+
dbra d0,.L1
lea.l R_Drawer,a1
move.l #301,d0
.L2 move.b (a1),d1
move.b (a0),(a1)+
move.b d1,(a0)+
dbra d0,.L2
jsr WriteQuestion
lea.l Exec_Text(pc),a5 ; get file to execute
move.l #R_G1c,R_def+nw_FirstGadget
jsr FileRequester
move.l d0,Exec_File
lea.l Exec_Puffer1(pc),a0 ; restore file name and drawer
lea.l R_File,a1
move.l #43,d0
.L3 move.b (a0),d1
move.b (a1),(a0)+
move.b d1,(a1)+
dbra d0,.L3
lea.l R_Drawer,a1
move.l #301,d0
.L4 move.b (a0),d1
move.b (a1),(a0)+
move.b d1,(a1)+
dbra d0,.L4
move.l #1,R_Read
tst.l Exec_File
bne Show_Patch
.wait move.l #1,R_Read ; don't display old file list
jmp wait
Exec_Text dc.b " Execute File: "
even
Show_Patch move.l Exec_File,d1 ; Copy file to RAM
move.l #MODE_OLDFILE,d2
CALLDOS_PC Open
tst.l d0
beq .OpenError
move.l d0,Exec_Filehandle
move.l d0,d1 ; get file size
moveq.l #0,d2
moveq.l #OFFSET_END,d3
CALLDOS_PC Seek
move.l Exec_Filehandle(pc),d1
moveq.l #0,d2
moveq.l #OFFSET_CURRENT,d3
CALLDOS_PC Seek
move.l d0,Exec_Size
move.l Exec_Filehandle(pc),d1
moveq.l #0,d2
moveq.l #OFFSET_BEGINNING,d3
CALLDOS_PC Seek
tst.l Exec_Size
beq .EmptyFile
addq.l #1,d0
moveq.l #MEMF_PUBLIC,d1
CALLEXEC AllocMem
tst.l d0
beq .NoMemory
move.l d0,Exec_Memory
move.l d0,d2
move.l Exec_Filehandle(pc),d1
move.l Exec_Size(pc),d3
CALLDOS_PC Read
cmp.l Exec_Size(pc),d0
bne .DiskError
add.l Exec_Memory(pc),d0 ; put 0 Byte at end of patch
move.l d0,a0
clr.b (a0)
move.l Exec_Filehandle(pc),d1
CALLDOS_PC Close
bsr Display_Patch
tst.l d0
bne.s .T1
bsr Do_Patch
cmp.l #2,d0
bne.s .T1
move.l Exec_Memory(pc),a1
move.l Exec_Size(pc),d0
addq.l #1,d0
CALLEXEC FreeMem
jmp OpenError
.T1 move.l Exec_Memory(pc),a1
move.l Exec_Size(pc),d0
addq.l #1,d0
CALLEXEC FreeMem
move.l Offset,d0
jmp GetBlock
.NoMemory move.l Exec_Filehandle(pc),d1
CALLDOS_PC Close
jmp NoMemory
.EmptyFile move.l Exec_Filehandle(pc),d1
CALLDOS_PC Close
jmp EmptyFile
.DiskError move.l Exec_Filehandle(pc),d1
CALLDOS_PC Close
.OpenError jmp OpenError
; +++++++++++++++++++++++++++++++++++++++++++++++++++++
; Display patch !!!
WindowPointer set Window2
Windowdef11 dc.w 8,26,464,165
dc.b -1,-1
dc.l GADGETUP!RAWKEY
dc.l ACTIVATE!SMART_REFRESH!RMBTRAP
dc.l DI_Gadget1
dc.l 0
dc.l 0
dc.l 0,0
dc.w 0,0,0,0,CUSTOMSCREEN
DI_Gadget1 FM_GADGET DI_Gadget2,20,145,90,1,<"Cancel">,1,2
DI_Gadget2 FM_GADGET DI_Gadget3,464-90-21,145,90,0,<"Execute">,1,2
DI_Gadget3 FM_GADGET DI_Gadget4,131,145,90,2,<"Move down">,1,4
DI_Gadget4 FM_GADGET 0,242,145,90,3,<"Move Up">,1,4
DI_Text ds.b 14*56
DT_Box BOX -1,-1,56*8,14*8,1,0
DI_Pos dc.l 0
Display_Patch lea.l Windowdef11(pc),a0 ; Display top of patch
jsr MakeWindow
tst.l d0
beq .D1
move.l d0,Window2
SETDRMD #RP_JAM1
WRITE #6+(454-7*8)/2,#14,#0,<"Execute">
WRITE #5+(454-7*8)/2,#13,#1,<"Execute">
clr.l DI_Pos
lea.l DT_Box(pc),a1
move.l Window2,a0
move.l wd_RPort(a0),a0
moveq.l #8,d0
move.l #30-6,d1
CALLINT_PC DrawBorder
.loop lea.l DI_Text(pc),a0 ; clear buffer
move.l #(14*56)-1,d0
.F0 move.b #" ",(a0)+
dbra d0,.F0
move.l Exec_Memory(pc),a0 ; copy file to puffer
add.l DI_Pos,a0
move.w #13,d7
lea.l DI_Text,a1
.F1 moveq.l #0,d6
move.l a1,a2
.F2 move.b (a0)+,d0
tst.b d0
beq .F3
cmp.b #10,d0
beq .F4
addq.l #1,d6
cmp.b #56,d6
bhi.s .F2
move.b d0,(a2)+
bra.s .F2
.F4 lea.l 56(a1),a1
dbra d7,.F1
.F3 SETDRMD #RP_JAM2
SETBPEN #0
WRITEMEM #8,#30,#6,DI_Text,#56
WRITEMEM #8,#30+(1*8),#6,DI_Text+(1*56),#56
WRITEMEM #8,#30+(2*8),#6,DI_Text+(2*56),#56
WRITEMEM #8,#30+(3*8),#6,DI_Text+(3*56),#56
WRITEMEM #8,#30+(4*8),#6,DI_Text+(4*56),#56
WRITEMEM #8,#30+(5*8),#6,DI_Text+(5*56),#56
WRITEMEM #8,#30+(6*8),#6,DI_Text+(6*56),#56
WRITEMEM #8,#30+(7*8),#6,DI_Text+(7*56),#56
WRITEMEM #8,#30+(8*8),#6,DI_Text+(8*56),#56
WRITEMEM #8,#30+(9*8),#6,DI_Text+(9*56),#56
WRITEMEM #8,#30+(10*8),#6,DI_Text+(10*56),#56
WRITEMEM #8,#30+(11*8),#6,DI_Text+(11*56),#56
WRITEMEM #8,#30+(12*8),#6,DI_Text+(12*56),#56
WRITEMEM #8,#30+(13*8),#6,DI_Text+(13*56),#56
.wait move.l Window2,a0 ; wait .....
move.l wd_UserPort(a0),a0
move.l a0,a5
CALLEXEC WaitPort
move.l a5,a0
CALLEXEC GetMsg ; get message
move.l d0,a1
move.l im_Class(a1),d4 ; get data
move.w im_Code(a1),d5
move.l im_IAddress(a1),a4
CALLEXEC ReplyMsg ; reply message
cmp.l #RAWKEY,d4
beq .Key
moveq.l #0,d0
move.w gg_GadgetID(a4),d0
cmp.b #2,d0
beq .down
cmp.b #3,d0
beq .up
move.l Window2,a0
CALLINT_PC CloseWindow
moveq.l #0,d0
move.w gg_GadgetID(a4),d0
.D1 rts
.Key cmp.b #$4d,d5
beq.s .down
cmp.b #$4c,d5
bne .wait
.up move.l Exec_Memory(pc),a0 ; move up
move.l DI_Pos(pc),d7
add.l d7,a0
.U1 tst.l d7 ; reached top ?
beq .U2
subq.l #1,d7
cmp.b #10,-(a0)
bne .U1
.U3 tst.l d7
beq .U2
subq.l #1,d7
cmp.b #10,-(a0)
bne .U3
addq.l #1,d7 ; Return belongs to previous line !
.U2 move.l d7,DI_Pos
bra .loop
.down move.l Exec_Memory(pc),a0 ; move down
move.l DI_Pos(pc),d7
add.l d7,a0
.P1 tst.b (a0) ; reached EOF ?
beq.s .P2
addq.l #1,d7
cmp.b #10,(a0)+
bne.s .P1
.P2 move.l d7,DI_Pos
bra .loop
; +++++++++++++++++++++++++++++++++++++++++++++++++++
*
* execute the patch !!!!
*
WindowPointer set Window2
Windowdef12 dc.w 8,80,464,70
dc.b -1,-1
dc.l GADGETUP
dc.l ACTIVATE!SMART_REFRESH!RMBTRAP
dc.l DP_Gadget1
dc.l 0
dc.l 0
dc.l 0,0
dc.w 0,0,0,0,CUSTOMSCREEN
DP_Gadget1 FM_GADGET DP_Gadget2,71,50,60,0,<"Cancel">,1,4
DP_Gadget2 FM_GADGET DP_Gadget3,71+71+60,50,60,1,<"OK">,1,4
DP_Gadget3 FM_GADGET 0,71+71+71+60+60,50,60,2,<"Skip">,1,4
DP_Text ds.b 56
DP_Box BOX -3,-3,56*8+2,10,1,DP_Box2
DP_Box2 BOX -2,-2,56*8+1,9,0,DP_Box3
DP_Box3 BOX -1,-1,56*8,8,0,0
Do_Patch lea.l Windowdef12(pc),a0
jsr MakeWindow
tst.l d0
beq .End
move.l d0,Window2
lea.l DP_Gadget2(pc),a0
move.l Window2,a1
sub.l a2,a2
CALLINT_PC OffGadget
lea.l DP_Gadget3(pc),a0
move.l Window2,a1
sub.l a2,a2
CALLINT_PC OffGadget
SETDRMD #RP_JAM1
WRITE #6+(454-9*8)/2,#14,#0,<"Executing">
WRITE #5+(454-9*8)/2,#13,#1,<"Executing">
lea.l DP_Box(pc),a1
move.l Window2,a0
move.l wd_RPort(a0),a0
moveq.l #8,d0
move.l #30-6,d1
CALLINT_PC DrawBorder
move.l Exec_Memory(pc),a4
.NewLine move.l Window2,a0 ; user break ?
move.l wd_UserPort(a0),a0
CALLEXEC GetMsg
tst.l d0
beq.s .F100
move.l d0,a1
CALLEXEC ReplyMsg
jmp .Exit
.F100 lea.l DP_Text(pc),a0 ; clear buffer
move.w #55,d0
.F0 move.b #" ",(a0)+
dbra d0,.F0
move.l a4,-(sp)
lea.l DP_Text(pc),a1 ; copy to buffer
.F1 moveq.l #0,d6
.F2 move.b (a4)+,d0
tst.b d0
beq.s .F4
cmp.b #10,d0
beq.s .F4
addq.l #1,d6
cmp.b #56,d6
bhi.s .F2
move.b d0,(a1)+
bra.s .F2
.F4 SETDRMD #RP_JAM2 ; show current line
SETBPEN #0
WRITEMEM #8,#30,#6,DP_Text,#56
move.l (sp)+,a4
move.l a4,.Line
.NewLine2 move.b (a4)+,d0
cmp.b #9,d0 ; skip tab and spaces
beq.s .NewLine2
cmp.b #" ",d0
beq.s .NewLine2
tst.b d0
beq .End
cmp.b #";",d0 ; comment ?
beq.s .Rem
cmp.b #"*",d0 ; comment ?
beq.s .Rem
cmp.b #10,d0 ; empty line ?
beq .NewLine
bra .Y1
.Rem move.b (a4)+,d0 ; skip line
tst.b d0
beq .End
cmp.b #10,d0
bne.s .Rem
bra .NewLine
.Offset ds.b 20
.Y1 lea.l .Offset(pc),a0
move.l #18,d2
move.b d0,(a0)+
.Y2 move.b (a4)+,d1 ; copy into buufer until
cmp.b #" ",d1 ; you encounter tab,space,":","="
beq.s .Y3
cmp.b #"=",d1
beq.s .Y3
cmp.b #":",d1
beq.s .Y3
cmp.b #9,d1
beq.s .Y3
tst.b d1
beq .Error
move.b d1,(a0)+
dbra d2,.Y2
bra .Error
.Y3 clr.b (a0) ; convert ASCII into hex
lea.l .Offset(pc),a0
jsr GetZahl
tst.l d1
bne .Error
move.l d0,Exec_Seek ; compare offset to file size
cmp.l Size,d0
bge .Error
.Y4 move.b (a4)+,d0 ; skip spaces,tabs and $
cmp.b #" ",d0
beq.s .Y4
cmp.b #9,d0
beq.s .Y4
cmp.b #"$",d0
beq.s .Y4
cmp.b #":",d0
beq.s .Y4
tst.b d0
beq .Error
cmp.b #34,d0 ; " ,' or ` -> ASCIIs
beq .ASCIIs
cmp.b #180,d0
beq .ASCIIs
cmp.b #$27,d0
beq .ASCIIs
.Y6 bsr .GetHex ; get hex
tst.l d0
bmi .Error
jsr .Exec_Write
cmp.l #2,d0
beq .Error
cmp.l #1,d0
bne .DiskError
.Y5 move.b (a4)+,d0 ; skip spaces,tabs and $
cmp.b #" ",d0
beq.s .Y5
cmp.b #9,d0
beq.s .Y5
cmp.b #"$",d0
beq.s .Y5
tst.b d0
beq .End
cmp.b #10,d0
beq .NewLine
bra .Y6
.Error move.l ScreenPtr1,a0
CALLINT_PC DisplayBeep
lea.l DP_Gadget1(pc),a0 ; switch off OK gadget
move.l Window2,a1
sub.l a2,a2
CALLINT_PC OnGadget
lea.l DP_Gadget2(pc),a0
move.l Window2,a1
sub.l a2,a2
CALLINT_PC OffGadget
lea.l DP_Gadget3(pc),a0
move.l Window2,a1
sub.l a2,a2
CALLINT_PC OnGadget
move.l Window2,a0 ; wait .....
move.l wd_UserPort(a0),a0
move.l a0,a5
CALLEXEC WaitPort
move.l a5,a0
CALLEXEC GetMsg ; get message
move.l d0,a1
move.l im_Class(a1),d4 ; get data
move.w im_Code(a1),d5
move.l im_IAddress(a1),a4
CALLEXEC ReplyMsg ; reply message
cmp.w #2,gg_GadgetID(a4)
bne .L1
move.l .Line(pc),a4 ; skip the line
.L2 move.b (a4)+,d0
tst.b d0 ; EOF ?
beq.s .L1
cmp.b #10,d0 ; end of line ( $a) reached ?
bne.s .L2
jmp .NewLine
.L1 move.l Window2,a0
CALLINT_PC CloseWindow
moveq.l #-1,d0
rts
.End SETDRMD #RP_JAM2
SETBPEN #0
WRITE #8,#30,#2,<" »» Done ! «« ">
lea.l DP_Gadget1(pc),a0 ; switch on only OK gadget
move.l Window2,a1
sub.l a2,a2
CALLINT_PC OffGadget
lea.l DP_Gadget2(pc),a0
move.l Window2,a1
sub.l a2,a2
CALLINT_PC OnGadget
lea.l DP_Gadget3(pc),a0
move.l Window2,a1
sub.l a2,a2
CALLINT_PC OffGadget
move.l Window2,a0 ; wait until user selects cancel
move.l wd_UserPort(a0),a0
CALLEXEC WaitPort
.Exit move.l Window2,a0
CALLINT_PC CloseWindow
moveq.l #0,d0
rts
.DiskError move.l Window2,a0
CALLINT_PC CloseWindow
moveq.l #2,d0
rts
even
.Line dc.l 0
;++++++++++
.Mark dc.b 0
even
.ASCIIs move.b d0,.Mark
.T1 move.b (a4)+,d0 ; there must be at least a character
tst.b d0
beq .Error
cmp.b .Mark(pc),d0
beq .Error
cmp.b #10,d0
beq .Error
.T2 bsr .Exec_Write ; write it
cmp.l #2,d0
beq .Error
cmp.l #1,d0
bne .DiskError
move.b (a4)+,d0
beq .Error
cmp.b .Mark(pc),d0
beq .ASCII_End
cmp.b #10,d0
beq .NewLine
bra .T2
.ASCII_End move.b (a4)+,d0 ; skip tabs and spaces
cmp.b #" ",d0
beq.s .ASCII_End
cmp.b #9,d0
beq.s .ASCII_End
tst.b d0
beq .End ; reached EOF ?
cmp.b #10,d0
bne .Error
bra .NewLine
.GetHex lea.l .Hex(pc),a2 ; ASCII -> Hex
moveq.l #-1,d2 ; get 1. nibble
.W3 addq.l #1,d2
cmp.l #32,d2
bhi .GHError
cmp.b (a2)+,d0
bne.s .W3
and.l #$f,d2
move.b (a4)+,d0
lea.l .Hex(pc),a2 ; ASCII -> Hex
moveq.l #-1,d3 ; get 2. nibble
.W4 addq.l #1,d3
cmp.l #32,d3
bhi .GHError
cmp.b (a2)+,d0
bne.s .W4
and.l #$f,d3
lsl.b #4,d2
or.b d3,d2
.W5 move.b d2,d0
rts
.GHError moveq.l #-1,d0
rts
.Hex dc.b "0123456789abcdef"
dc.b "0123456789ABCDEF"
.Exec_Write move.l Memory,a0 ; write d0
cmp.l #0,a0
beq .Write_Device
move.l Exec_Seek(pc),d1
cmp.l Size,d1
bge .J2
add.l Exec_Seek(pc),a0
move.b d0,(a0)
add.l #1,Exec_Seek
move.b #1,FlagWrite ; something was changed !!!
moveq.l #1,d0
rts
.J2 moveq.l #2,d0
rts
.Write_Device move.l d0,.Buffer ; write d0 on device
move.l Filehandle,d1
move.l Exec_Seek(pc),d2
moveq.l #OFFSET_BEGINNING,d3
CALLDOS_PC Seek
tst.l d0
bmi .J1
move.l Filehandle,d1
move.l #.Buffer,d2
moveq.l #1,d3
CALLDOS_PC Write
.J1 rts
.Buffer dc.b 0
********************************************************
KEY_INFO lea.l Windowdef6,a0 ; show keys
jsr MakeWindow
tst.l d0
beq .wait
move.l d0,Window2
move.l d0,a0
move.l wd_RPort(a0),a0
lea.l FM_LOGO,a1
moveq.l #4,d1
move.l #(350-241)/2,d0
CALLINT_PC DrawImage
SETDRMD #RP_JAM1
WRITE #6+(340-8*8)/2,#46,#0,<"» Keys «"
WRITE #6+(340-38*8)/2,#61,#0,<"F1 - Open F6 - Write ">
WRITE #6+(340-38*8)/2,#71,#0,<"F2 - Save As F7 - Undo ">
WRITE #6+(340-38*8)/2,#81,#0,<"F3 - Execute F8 - Search ">
WRITE #6+(340-38*8)/2,#91,#0,<"F4 - Forward F9 - Previous ">
WRITE #6+(340-38*8)/2,#101,#0,<"F5 - Backward F10 - Next ">
WRITE #6+(340-38*8)/2,#111,#0,<"ESC - Quit Ins - Change Mode">
WRITE #5+(340-8*8)/2,#45,#6,<"» Keys «"
WRITE #5+(340-38*8)/2,#60,#5,<"F1 - Open F6 - Write ">
WRITE #5+(340-38*8)/2,#70,#5,<"F2 - Save As F7 - Undo ">
WRITE #5+(340-38*8)/2,#80,#5,<"F3 - Execute F8 - Search ">
WRITE #5+(340-38*8)/2,#90,#5,<"F4 - Forward F9 - Previous ">
WRITE #5+(340-38*8)/2,#100,#5,<"F5 - Backward F10 - Next ">
WRITE #5+(340-38*8)/2,#110,#5,<"ESC - Quit Ins - Change Mode">
move.l Window2,a0
move.l wd_UserPort(a0),a0
move.l a0,a5
CALLEXEC WaitPort
move.l Window2,a0
CALLINT_PC CloseWindow
.wait jmp wait
***********************************************************
; close Workbench (saves about 40 KB) or open it if it's closed
WORKBENCH CALLINT_PC CloseWorkBench
tst.l d0
bne .Close
CALLINT_PC OpenWorkBench
tst.l d0 ; success ?
beq .Error
move.l ScreenPtr1,a0
CALLINT_PC ScreenToFront
lea.l Windowdef13(pc),a0
jsr MakeWindow
tst.l d0
beq .wait
move.l d0,Window2
SETDRMD #RP_JAM1
WRITE #5+(290-33*8)/2,#19,#0,<"Workbench opened / Close failed !">
WRITE #5+(290-33*8)/2,#18,#1,<"Workbench opened / Close failed !">
bra .Warten
.Close lea.l Windowdef13(pc),a0
jsr MakeWindow
tst.l d0
beq .wait
move.l d0,Window2
SETDRMD #RP_JAM1
WRITE #5+(290-18*8)/2,#19,#0,<"Workbench closed !">
WRITE #5+(290-18*8)/2,#18,#1,<"Workbench closed !">
bra .Warten
.Error lea.l Windowdef13(pc),a0
jsr MakeWindow
tst.l d0
beq .wait
move.l d0,Window2
SETDRMD #RP_JAM1
WRITE #5+(290-28*8)/2,#19,#0,<"Can't open/close Workbench !">
WRITE #5+(290-28*8)/2,#18,#1,<"Can't open/close Workbench !">
.Warten move.l Window2,a0
move.l wd_UserPort(a0),a0
move.l a0,a5
CALLEXEC WaitPort
move.l Window2,a0
CALLINT_PC CloseWindow
.wait jmp wait
Windowdef13 dc.w 60,75,300,50
dc.b -1,-1
dc.l GADGETUP!VANILLAKEY
dc.l ACTIVATE!SMART_REFRESH!RMBTRAP
dc.l .Gadget1
dc.l 0
dc.l 0
dc.l 0,0
dc.w 0,0,0,0,CUSTOMSCREEN
.Gadget1 FM_GADGET 0,125,30,50,0,<"OK">,1,4
**********************************************************
UNDO_CHAR tst.b FlagFile
beq.s .Nothing
lea.l Puffer,a0 ; copy byte from undo buffer
move.l Cursor,d0 ; to display
lea.l UndoPuffer,a1
move.b (a1,d0),(a0,d0) ; copy
lea.l Color,a0
move.b #3,(a0,d0) ; reset colour
addq.l #1,d0 ; write byte and move cursor
cmp.l AnzahlBytes,d0
bge.s .L2
jsr SetCursor
jmp wait
.L2 subq.l #1,d0
jsr SetCursor
.Nothing jmp wait
***************************************************************
UNDO_CHAR_BACK tst.b FlagFile
beq.s .Nothing
lea.l Puffer,a0 ; copy byte from undo buffer
move.l Cursor,d0 ; to display
beq.s .L3
subq.l #1,d0
.L3 lea.l UndoPuffer,a1
move.b (a1,d0),(a0,d0) ; copy
lea.l Color,a0
move.b #3,(a0,d0) ; reset colour
jsr SetCursor ; write byte and move cursor
.Nothing jmp wait
***************************************************************
; convert ASCII to HEX , etc.
WindowPointer set Window2
Windowdef14 dc.w 50,40,370,130
dc.b -1,-1
dc.l GADGETUP
dc.l ACTIVATE!SMART_REFRESH!RMBTRAP
dc.l CO_Gadget1
dc.l 0
dc.l 0
dc.l 0,0
dc.w 0,0,0,0,CUSTOMSCREEN
CO_Gadget1 FM_GADGET CO_Gadget2,(360-80)/2,110,80,0,<"OK">,1,4
CO_Gadget2 dc.l CO_Gadget3
dc.w 80,40-12,34*8,10,GADGHCOMP,RELVERIFY,STRGADGET
dc.l CO_G1_Box,0,0,0,CO_G1_Info
dc.w 100,0,0
CO_G1_Box BOX -1,-1,272+1,8,2,CO_G1_Box2
CO_G1_Box2 BOX -2,-2,272+2,9,1,0
CO_G1_Info dc.l CO_G1_Puffer,CO_G1_Undo
dc.w 0,34
ds.w 34
CO_G1_Puffer ds.b 40
CO_G1_Undo ds.b 40
CO_Gadget3 dc.l CO_Gadget4
dc.w 80,40-12+20,34*8,10,GADGHCOMP,RELVERIFY,STRGADGET
dc.l CO_G1_Box,0,0,0,CO_G2_Info
dc.w 101,0,0
CO_G2_Info dc.l CO_G2_Puffer,CO_G2_Undo
dc.w 0,34
ds.w 34
dc.b " $"
CO_G2_Puffer ds.b 40
CO_G2_Undo ds.b 40
CO_Gadget4 dc.l CO_Gadget5
dc.w 80,40-12+40,34*8,10,GADGHCOMP,RELVERIFY,STRGADGET
dc.l CO_G1_Box,0,0,0,CO_G3_Info
dc.w 102,0,0
CO_G3_Info dc.l CO_G3_Puffer,CO_G3_Undo
dc.w 0,34
ds.w 34
CO_G3_Puffer ds.b 40
CO_G3_Undo ds.b 40
CO_Gadget5 dc.l 0
dc.w 80,40-12+60,34*8,10,GADGHCOMP,RELVERIFY,STRGADGET
dc.l CO_G1_Box,0,0,0,CO_G4_Info
dc.w 103,0,0
CO_G4_Info dc.l CO_G4_Puffer,CO_G4_Undo
dc.w 0,34
ds.w 34
CO_G4_Puffer ds.b 40
CO_G4_Undo ds.b 40
CONVERTER lea.l Windowdef14(pc),a0
jsr MakeWindow
tst.l d0
beq .wait
move.l d0,Window2
SETDRMD #RP_JAM1
WRITE #6+(360-11*8)/2,#11,#0,<"Converter :">
WRITE #5+(360-11*8)/2,#10,#1,<"Converter :">
WRITE #10,#40-6,#5,<"Decimal:">
WRITE #10,#60-6,#5,<"Hex ($):">
WRITE #10,#80-6,#5,<"Bin (%):">
WRITE #10,#100-6,#5,<"ASCII :">
lea.l CO_Gadget2(pc),a0
move.l WindowPointer,a1
sub.l a2,a2
CALLINT_PC ActivateGadget
.WARTEN move.l Window2,a0 ; wait .....
move.l wd_UserPort(a0),a0
move.l a0,a5
CALLEXEC WaitPort
move.l a5,a0
CALLEXEC GetMsg ; get message
move.l d0,a1
move.l im_Class(a1),d4 ; get data
move.w im_Code(a1),d5
move.l im_IAddress(a1),a4
CALLEXEC ReplyMsg ; reply message
move.w gg_GadgetID(a4),d0
cmp.b #100,d0
beq .NewDecimal
cmp.b #101,d0
beq .NewHex
cmp.b #102,d0
beq .ReadBin
cmp.b #103,d0
beq .NewASCII
tst.b d0
bne.s .WARTEN
.Exit move.l Window2,a0
CALLINT_PC CloseWindow
.wait jmp wait
.Zahl dc.l 12345
.Error clr.b CO_G1_Puffer ; error
clr.b CO_G2_Puffer
clr.b CO_G3_Puffer
clr.b CO_G4_Puffer
lea.l CO_Gadget2(pc),a0
move.l WindowPointer,a1 ; redraw gadgets
sub.l a2,a2
CALLINT_PC RefreshGadgets
move.l ScreenPtr1,a0
CALLINT_PC DisplayBeep
bra .WARTEN
.NewDecimal lea.l CO_G1_Puffer(pc),a0 ; get decimal
jsr GetZahl
tst.l d1
bne .Error
move.l d0,.Zahl
bra .NewInput
.NewHex lea.l CO_G2_Puffer-1(pc),a0 ; get hex (add "$")
jsr GetZahl
tst.l d1
bne .Error
move.l d0,.Zahl
bra .NewInput
.NewASCII lea.l CO_G4_Puffer(pc),a0 ; get ASCII
moveq.l #0,d0
move.b (a0)+,d0 ; last Char ?
beq.s .Error ; empty string ????
lsl.l #8,d0
move.b (a0)+,d0 ; last Char ?
beq.s .Z1
lsl.l #8,d0
move.b (a0)+,d0 ; last Char ?
beq.s .Z1
lsl.l #8,d0
move.b (a0)+,d0 ; last Char ?
beq.s .Z1
move.l d0,.Zahl
bra.s .NewInput
.Z1 lsr.l #8,d0
move.l d0,.Zahl
; write new numbers & text
.NewInput move.l d0,d6 ; decimal
lea.l CO_G1_Puffer(pc),a0
jsr MakeZahlU
clr.b (a0)
move.l d6,d0
lea.l CO_G2_Puffer(pc),a0 ; hex ($)
jsr MakeHexU
clr.b (a0)
lea.l CO_G3_Puffer(pc),a0 ; bin (%)
move.w #31,d1
.Label1 move.b #"0",d2
btst d1,d6
beq.s .Zero
bset #0,d2
.Zero move.b d2,(a0)+
dbra d1,.Label1
clr.b (a0)+
lea.l CO_G4_Puffer+5(pc),a0 ; ASCII
clr.b -(a0)
moveq.l #3,d1
.Label2 move.b d6,d0
tst.b d0
bne.s .NotZero
move.b #" ",d0
.NotZero move.b d0,-(a0)
lsr.l #8,d6
dbra d1,.Label2
lea.l CO_Gadget2(pc),a0
move.l WindowPointer,a1 ; redraw gadgets
sub.l a2,a2
CALLINT_PC RefreshGadgets
bra .WARTEN
.ReadBin lea.l CO_G3_Puffer(pc),a0 ; read bin (%)
.O1 tst.b (a0)+
bne.s .O1
tst.b -(a0)
moveq.l #0,d0
moveq.l #0,d1
.O2 move.b -(a0),d2
cmp.b #"0",d2
beq.s .O4
cmp.b #"1",d2
bne .Error
bset d1,d0 ; set bit
.O4 addq.l #1,d1
cmp.l #CO_G3_Puffer,a0
beq.s .O3
cmp.b #32,d1
beq .Error
bra.s .O2
.O3 move.l d0,.Zahl
bra .NewInput
MakeHexU movem.l d0-d7/a1-a5,-(sp) ; convert d0 into HEX without -/+ (a0 ^buffer)
.MH0 move.l d0,d1
move.l #32-4,d2
lea.l .Hex(pc),a1
moveq.l #0,d3
.MH1 move.l d1,d0
lsr.l d2,d0
and.l #$f,d0
tst.l d2
beq.s .MH3
tst.b d3
bne.s .MH3
tst.b d0
beq.s .MH2
.MH3 move.b (a1,d0),(a0)+
moveq.l #1,d3
.MH2 subq.l #4,d2
cmp.l #-4,d2
bne.s .MH1
movem.l (sp)+,d0-d7/a1-a5
rts
.Hex dc.b "0123456789abcdef"
MakeZahlU movem.l d0-d7/a1-a5,-(sp) ; convert d0 into ASCII without +/- (a0 ^buffer)
.MZ0 moveq.l #9,d2
moveq.l #0,d3
lea.l .MZ_Potenzen(pc),a2
.MZ1 move.b #"0"-1,d1
.MZ2 addq #1,d1
sub.l (a2),d0
bcc.s .MZ2
add.l (a2)+,d0
tst.b d2
beq.s .MZ3
cmp.b #"0",d1
beq.s .MZ4
moveq.l #1,d3
bra.s .MZ3
.MZ4 tst.b d3
beq.s .MZ5
.MZ3 move.b d1,(a0)+
.MZ5 dbra d2,.MZ1
movem.l (sp)+,d0-d7/a1-a5
rts
.MZ_Potenzen dc.l 1000000000
dc.l 100000000
dc.l 10000000
dc.l 1000000
dc.l 100000
dc.l 10000
dc.l 1000
dc.l 100
dc.l 10
dc.l 1
******************************************************************
; set marks accoding to preferences
Hardcopy_Gadgets
move.b PrintQuality,d0 ; set marks
lea.l HC_Gadget3+gg_GadgetRender,a0
move.l (a0),a0
move.l ig_NextImage(a0),a0
clr.l ig_NextImage(a0)
lea.l HC_Gadget4+gg_GadgetRender,a0
move.l (a0),a0
move.l ig_NextImage(a0),a0
clr.l ig_NextImage(a0)
lea.l HC_Gadget5+gg_GadgetRender,a0
move.l (a0),a0
move.l ig_NextImage(a0),a0
clr.l ig_NextImage(a0)
lea.l HC_Gadget3+gg_GadgetRender,a0
tst.b d0
beq.s .Label1
lea.l HC_Gadget4+gg_GadgetRender,a0
cmp.b #1,d0
beq.s .Label1
lea.l HC_Gadget5+gg_GadgetRender,a0
.Label1 move.l (a0),a0
move.l ig_NextImage(a0),a0
move.l #SELECT_Image,ig_NextImage(a0)
move.b PrintMark,d0
move.l HC_Gadget6+gg_GadgetRender,a0
move.l ig_NextImage(a0),a0
clr.l ig_NextImage(a0)
move.l HC_Gadget7+gg_GadgetRender,a0
move.l ig_NextImage(a0),a0
clr.l ig_NextImage(a0)
move.l HC_Gadget8+gg_GadgetRender,a0
move.l ig_NextImage(a0),a0
clr.l ig_NextImage(a0)
move.l HC_Gadget9+gg_GadgetRender,a0
move.l ig_NextImage(a0),a0
clr.l ig_NextImage(a0)
btst #0,d0
beq.s .Label2
move.l HC_Gadget6+gg_GadgetRender,a0
move.l ig_NextImage(a0),a0
move.l #SELECT_Image,ig_NextImage(a0)
.Label2 btst #1,d0
beq.s .Label3
move.l HC_Gadget7+gg_GadgetRender,a0
move.l ig_NextImage(a0),a0
move.l #SELECT_Image,ig_NextImage(a0)
.Label3 btst #2,d0
beq.s .Label4
move.l HC_Gadget8+gg_GadgetRender,a0
move.l ig_NextImage(a0),a0
move.l #SELECT_Image,ig_NextImage(a0)
.Label4 btst #3,d0
beq.s .Label5
move.l HC_Gadget9+gg_GadgetRender,a0
move.l ig_NextImage(a0),a0
move.l #SELECT_Image,ig_NextImage(a0)
.Label5 rts
*******************************************************************
; hardcopy of sector
PrintHandle dc.l 0
WindowPointer set Window2
Windowdef15 dc.w 40,36,370,140
dc.b -1,-1
dc.l GADGETUP!GADGETDOWN
dc.l ACTIVATE!SMART_REFRESH!RMBTRAP
dc.l HC_Gadget1
dc.l 0
dc.l 0
dc.l 0,0
dc.w 0,0,0,0,CUSTOMSCREEN
HC_Gadget1 FM_GADGET HC_Gadget2,10,120,110,0,<"Cancel">,1,2
HC_Gadget2 FM_GADGET HC_Gadget2b,130,120,110,1,<"Write">,1,2
HC_Gadget2b FM_GADGET HC_Gadget3,250,120,110,2,<"Write/Header">,1,2
HC_Gadget3 FM_GADGET HC_Gadget4,130-40,50,70+13,0+128,<"Draft">,1,4
HC_Gadget4 FM_GADGET HC_Gadget5,210-40+13,50,70+13,1+128,<"Letter">,1,4
HC_Gadget5 FM_GADGET HC_Gadget6,290-40+26,50,70+13,2+128,<"Default">,1,4
HC_Gadget6 FM_GADGET HC_Gadget7,130-40,70,70+40+20,0+64,<"Italics">,1,4
HC_Gadget7 FM_GADGET HC_Gadget8,210+40-20,70,70+40+20,1+64,<"Bold">,1,4
HC_Gadget8 FM_GADGET HC_Gadget9,130-40,90,70+40+20,2+64,<"Underline">,1,4
HC_Gadget9 FM_GADGET HC_Gadget12,210+40-20,90,70+40+20,3+64,<"Colour">,1,4
HC_Gadget12 dc.l 0
dc.w 11,30+1,43*8,10,GADGHCOMP,STRINGCENTER,STRGADGET
dc.l HC_G12_Box,0,0,0,HC_G12_Info
dc.w 10,0,0
HC_G12_Box BOX -1,-1,344,8,2,HC_G12_Box2
HC_G12_Box2 BOX -2,-2,345,9,1,0
HC_G12_Info dc.l HC_G12_Puffer,HC_G12_Undo
dc.w 0,98
ds.w 12
HC_G12_Puffer dc.b "PRT:",0
ds.b 100
even
HC_G12_Undo ds.b 100
even
PRINT move.w #GADGIMMEDIATE,d0
move.w d0,HC_Gadget3+gg_Activation ; modify gadgets
move.w d0,HC_Gadget4+gg_Activation
move.w d0,HC_Gadget5+gg_Activation
move.w d0,HC_Gadget6+gg_Activation
move.w d0,HC_Gadget7+gg_Activation
move.w d0,HC_Gadget8+gg_Activation
move.w d0,HC_Gadget9+gg_Activation
tst.b FlagFile ; no sector -> no hardcopy
beq .wait
move.l Offset,d0
divu #512,d0
and.l #$ffff,d0
addq #1,d0
move.l d0,.PrintSector
lea.l Windowdef15(pc),a0
jsr MakeWindow
tst.l d0
beq .wait
move.l d0,Window2
SETDRMD #RP_JAM1
WRITE #6+(370-10*8)/2,#11,#0,<"Hardcopy :">
WRITE #5+(370-10*8)/2,#10,#1,<"Hardcopy :">
WRITE #10,#58,#1,<"Quality:">
WRITE #10,#78,#1,<"Mark :">
lea.l HC_Gadget12(pc),a0
move.l WindowPointer,a1
sub.l a2,a2
CALLINT_PC RefreshGadgets
lea.l HC_Gadget12(pc),a0
move.l WindowPointer,a1
sub.l a2,a2
CALLINT_PC ActivateGadget
.Message move.l Window2,a0 ; wait .....
move.l wd_UserPort(a0),a0
move.l a0,a5
CALLEXEC WaitPort
move.l a5,a0
CALLEXEC GetMsg ; get message
move.l d0,a1
move.l im_Class(a1),d4 ; get data
move.w im_Code(a1),d5
move.l im_IAddress(a1),a4
CALLEXEC ReplyMsg ; reply message
moveq.l #0,d0
move.w gg_GadgetID(a4),d0
btst #7,d0 ; quality gadget ?
bne .NewQuality
btst #6,d0 ; mark gadget ?
bne .NewMark
move.b d0,d5
move.l Window2,a0 ; close window
CALLINT_PC CloseWindow
tst.b d5 ; cancel selected ?
bne Print_It
.wait jmp wait
.PrintSector dc.l 0
.NewQuality bclr #7,d0 ; set new quality
move.b d0,PrintQuality
lea.l HC_Gadget3+gg_GadgetRender(pc),a0 ; clear
move.l (a0),a0
move.l ig_NextImage(a0),a0
clr.l ig_NextImage(a0)
lea.l HC_Gadget4+gg_GadgetRender(pc),a0 ; clear
move.l (a0),a0
move.l ig_NextImage(a0),a0
clr.l ig_NextImage(a0)
lea.l HC_Gadget5+gg_GadgetRender(pc),a0 ; clear
move.l (a0),a0
move.l ig_NextImage(a0),a0
clr.l ig_NextImage(a0)
lea.l HC_Gadget3+gg_GadgetRender(pc),a0 ; set mark
tst.b d0
beq.s .Label1
lea.l HC_Gadget4+gg_GadgetRender(pc),a0
cmp.b #1,d0
beq.s .Label1
lea.l HC_Gadget5+gg_GadgetRender(pc),a0
.Label1 move.l (a0),a0
move.l ig_NextImage(a0),a0
move.l #SELECT_Image,ig_NextImage(a0)
lea.l HC_Gadget3(pc),a0 ; draw mark
move.l WindowPointer,a1
sub.l a2,a2
moveq.l #3,d0
CALLINT_PC RefreshGList
bra .Message
.NewMark bclr #6,d0 ; new mark
bchg d0,PrintMark ; invert flag
beq .Set_Flag ; set flag
move.l gg_GadgetRender(a4),a0 ; clear
move.l ig_NextImage(a0),a0
clr.l ig_NextImage(a0)
move.l a4,a0 ; refresh gadgets
move.l WindowPointer,a1
sub.l a2,a2
moveq.l #1,d0
CALLINT_PC RefreshGList
bra .Message
.Set_Flag move.l gg_GadgetRender(a4),a0 ; clear
move.l ig_NextImage(a0),a0
move.l #SELECT_Image,ig_NextImage(a0)
move.l a4,a0 ; refresh gadgets
move.l WindowPointer,a1
sub.l a2,a2
moveq.l #1,d0
CALLINT_PC RefreshGList
bra .Message
; print sector
Print_It move.b d5,.Header
clr.b PrintMarkFlag
move.l #HC_G12_Puffer,d1 ; open output file
move.l #MODE_NEWFILE,d2
CALLDOS_PC Open
move.l d0,PrintHandle
beq .OpenError
tst.b PrintQuality ; set quality
bne.s .NoDraft
move.l PrintHandle(pc),d1 ; draft
lea.l .Draft(pc),a0
move.l a0,d2
moveq.l #4,d3
CALLDOS_PC Write
cmp.l d3,d0
bne .Error
bra .Default
.NoDraft cmp.b #1,PrintQuality
bne.s .Default
move.l PrintHandle(pc),d1 ; NLQ
lea.l .NLQ(pc),a0
move.l a0,d2
moveq.l #4,d3
CALLDOS_PC Write
cmp.l d3,d0
bne .Error
.Default cmp.b #1,.Header
beq.s .NoHeader
move.l PrintHandle(pc),d1 ; write header
lea.l PrintHeader(pc),a0
move.l a0,d2
move.l #PH_End-PrintHeader,d3
CALLDOS_PC Write
cmp.l d3,d0
bne .Error
.NoHeader lea.l Puffer,a4 ; a4 ^ buffer
move.l a4,a5 ; a5 ^ buffer
move.l a4,a3 ; a3 ^ end of buffer
add.l AnzahlBytes,a3
move.l PrintHandle(pc),d1 ; write $a
lea.l .Return(pc),a0
move.l a0,d2
moveq.l #1,d3
CALLDOS_PC Write
cmp.l d3,d0
bne .Error
.Label0 bsr UndoStyle ; undo style
tst.l d0
bne .Error
move.l a4,a0 ; write offset
sub.l #Puffer,a0
move.l a0,d2
lsr.l #2,d2
lea.l .Lines(pc),a0
add.l a0,d2
moveq.l #4,d3
move.l PrintHandle(pc),d1
CALLDOS_PC Write
cmp.l d0,d3
bne .Error
move.l PrintHandle(pc),d1 ; write space
lea.l .Space(pc),a0
move.l a0,d2
moveq.l #1,d3
CALLDOS_PC Write
cmp.l d3,d0
bne .Error
moveq.l #3,d7 ; 4 longwords
.Label1 moveq.l #3,d6 ; containing 4 bytes
.Label2 cmp.b #3,Color-Puffer(a4) ; check if byte should be marked
beq.s .No1
bsr ChangeStyle
bra.s .T1
.No1 bsr UndoStyle ; undo style
.T1 tst.l d0
bne .Error
lea.l HEX,a0 ; convert byte into hex
lea.l .ASCII(pc),a1
moveq.l #0,d0
move.b (a4),d0
lsr.l #4,d0
move.b (a0,d0),(a1)
move.b (a4)+,d0
and.w #$f,d0
move.b (a0,d0),1(a1)
cmp.l a3,a4 ; print space if end of sector
bls .Label6
move.b #" ",(a1)
move.b #" ",1(a1)
move.l a1,-(sp)
bsr UndoStyle ; undo style
move.l (sp)+,a1
tst.l d0
bne .Error
.Label6 move.l PrintHandle(pc),d1 ; write hex
move.l a1,d2
moveq.l #2,d3
CALLDOS_PC Write
cmp.l d3,d0
bne .Error
dbra d6,.Label2
bsr UndoStyle ; undo style
tst.l d0
bne .Error
move.l PrintHandle(pc),d1 ; write space
lea.l .Space(pc),a0
move.l a0,d2
moveq.l #1,d3
CALLDOS_PC Write
cmp.l d3,d0
bne .Error
dbra d7,.Label1
bsr UndoStyle ; undo style
tst.l d0
bne .Error
move.l PrintHandle(pc),d1 ; write some spaces
lea.l .Space(pc),a0
move.l a0,d2
moveq.l #4,d3
CALLDOS_PC Write
cmp.l d3,d0
bne .Error
move.w #15,d7 ; write 16 ASCII codes
lea.l .Byte(pc),a2
.Label3 cmp.b #3,Color-Puffer(a5) ; check if byte should be marked
beq.s .No2
bsr ChangeStyle
bra.s .T2
.No2 bsr UndoStyle ; undo style
.T2 tst.l d0
bne .Error
move.b (a5)+,d4
cmp.b #$7f,d4 ; $7f must be replaced !!!!!!!!
beq.s .K4
cmp.b #1,DisplayMode ; replace 0-$1f and $80-$9f
bhi.s .K2 , display mode 0 is impossible
.K5 move.b d4,d0
and.b #$7f,d0
cmp.b #$1f,d0
bhi.s .K1
.K4 move.b #".",d4
bra.s .K1
.K2 cmp.b #$7d,d4 ; replace 0-$1f and $7e-$ff
bhi.s .K4
cmp.b #$1f,d4
bls.s .K4
.K1 move.b d4,(a2)
cmp.l a3,a5 ; print space if end of sector
bls .Label4
move.w #" ",(a2)
.Label4 move.l PrintHandle(pc),d1 ; write ASCII code
move.l a2,d2
moveq.l #1,d3
CALLDOS_PC Write
cmp.l d3,d0
bne .Error
dbra d7,.Label3
move.l PrintHandle(pc),d1 ; write $a
lea.l .Return(pc),a0
move.l a0,d2
moveq.l #1,d3
CALLDOS_PC Write
cmp.l d3,d0
bne .Error
cmp.l a4,a3
bhi .Label0
move.l PrintHandle(pc),d1 ; write $a
lea.l .Return(pc),a0
move.l a0,d2
moveq.l #1,d3
CALLDOS_PC Write
cmp.l d3,d0
bne .Error
bsr UndoStyle ; undo style
tst.l d0
bne .Error
nop
.Error move.l PrintHandle(pc),d1
CALLDOS_PC Close
.OpenError jmp wait
.Lines dc.b "000:010:020:030:040:050:060:070:080:090:0A0:0B0:0C0:0D0:0E0:0F0:"
dc.b "100:110:120:130:140:150:160:170:180:190:1A0:1B0:1C0:1D0:1E0:1F0:"
even
.ASCII dc.b "xx"
even
.Space dc.b " "
even
.Return dc.b $a
.Header dc.b 0
even
.Byte dc.b "x"
even
.Draft dc.b $9b,'1"z'
even
.NLQ dc.b $9b,'2"z'
even
PrintMarkFlag dc.b 0
even
ChangeStyle lea.l PrintMarkFlag(pc),a0
tst.b (a0)
bne .OK
move.b #1,(a0)
move.b PrintMark,d4 ; mark changes
move.b #"1",d1
btst #3,d4
beq.s .PM_1
addq #2,d1
.PM_1 move.b d1,.ITALICS+4 ; change colour
move.b d1,.BOLD+4
move.b d1,.UNDERLINE+4
btst #0,d4
beq.s .NoItalics
move.l PrintHandle(pc),d1 ; set style : italics
lea.l .ITALICS(pc),a0
move.l a0,d2
moveq.l #9,d3
CALLDOS_PC Write
cmp.l d3,d0
bne .Error
.NoItalics btst #1,d4
beq.s .NoBold
move.l PrintHandle(pc),d1 ; set style : bold
lea.l .BOLD(pc),a0
move.l a0,d2
moveq.l #9,d3
CALLDOS_PC Write
cmp.l d3,d0
bne .Error
.NoBold btst #2,d4
beq.s .NoUnderline
move.l PrintHandle(pc),d1 ; set style : underline
lea.l .UNDERLINE(pc),a0
move.l a0,d2
moveq.l #9,d3
CALLDOS_PC Write
cmp.l d3,d0
bne .Error
.OK
.NoUnderline moveq.l #0,d0 ; no error occurred
rts
.Error moveq.l #-1,d0
rts
.ITALICS dc.b $9b,"3;31;40m"
even
.BOLD dc.b $9b,"1;31;40m"
even
.UNDERLINE dc.b $9b,"4;31;40m"
even
UndoStyle lea.l PrintMarkFlag(pc),a0 ; if style wasn't changed
tst.b (a0) ; it needn't be reseted.
beq.s .OK
clr.b (a0)
move.l PrintHandle(pc),d1 ; undo style
lea.l .UNDOSTYLE(pc),a0
move.l a0,d2
moveq.l #9,d3
CALLDOS_PC Write
cmp.l d3,d0
bne .Error
.OK moveq.l #0,d0
rts
.Error moveq.l #-1,d0
rts
.UNDOSTYLE dc.b $9b,"0;31;40m"
even
PrintHeader dc.b "FILE : " ; header
ds.b 60
dc.b $a
PrintHeader2 dc.b "SECTOR : "
ds.b 5
dc.b $A
dc.b "-------------------------------------------------------------"
PH_End
***************************************************************
UPCASE cmp.b #"A"-1,d0 ; check A-Z
bls.s .Different
cmp.b #"Z",d0
bhi.s .Different
add.b #"a"-"A",d0
.Different cmp.b #$e0-1,d0 ; foreign characters ?
bls.s .NoChange
sub.b #$20,d0
.NoChange rts
UPCASE_D1 tst.l SearchCase ; case sensitive ?
beq .NoChange
cmp.b Joker,d1 ; joker ?
beq .NoChange
cmp.b #"A"-1,d1 ; check A-Z
bls.s .Different
cmp.b #"Z",d1
bhi.s .Different
add.b #"a"-"A",d1
.Different cmp.b #$e0-1,d1 ; foreign characters ?
bls.s .NoChange
sub.b #$20,d1
.NoChange rts
**********************************************************************
; exchange drive names DF1: / DF2: (file requester)
DRIVE lea.l M1_I6_String+12,a0
lea.l DriveName+2,a1
cmp.b #"1",(a0)
beq.s .df2
move.b #"1",(a0)
move.b #"1",(a1)
jmp wait
.df2 move.b #"2",(a0)
move.b #"2",(a1)
jmp wait
**********************************************************************
**********************************************************************
* this section contains several images so it has to be in CHIP mem !!!
Section "Pfeile",DATA_C
R_G9_PfeilUp dc.w 0,0,15,9,1
dc.l R_G9_PU_image
dc.b 1,0
dc.l 0
R_G9_PU_image dc.w 0
dc.w %0000000100000000
dc.w %0000001110000000
dc.w %0000011111000000
dc.w %0000111111100000
dc.w %0001111111110000
dc.w %0011111111111000
dc.w %0111111111111100
dc.w 0
R_G10_PfeilD dc.w 0,0,15,9,1
dc.l R_G10_PD_image
dc.b 1,0
dc.l 0
R_G10_PD_image dc.w 0
dc.w %0111111111111100
dc.w %0011111111111000
dc.w %0001111111110000
dc.w %0000111111100000
dc.w %0000011111000000
dc.w %0000001110000000
dc.w %0000000100000000
dc.w 0
SELECT_Image dc.w 0,0,14,12,3
dc.l .Image
dc.b 1+2+4,0
dc.l 0
.Image
incbin "Sign.Raw"
FM_LOGO dc.w 0,0,241,23,3
dc.l FM_Data
dc.b 1+2+4,0
dc.l 0
even
FM_Data
incbin "FM.Image"
FONT_PAL1
incbin "Font1.data"
even
FONT_NTSC1
incbin "Font3.Data"
even
FM_Font dc.l 0
Puffer ds.b 512
UndoPuffer ds.b 512
Puffer2 ds.b 512
Color ds.b 512
AnzahlBytes dc.l 499
Mode dc.b 1
Nibble dc.b 0
FlagFile dc.b 0
FlagWrite dc.b 0
DisplayMode dc.b 0
even
; preferences
PREFS
Palette dc.w $000,$eee,$775,$313,$04d,$997,$4b9,$553
WriteMode dc.b 0 ;0=ask, 1=write, 2=do nothing
Joker dc.b "?"
PrintQuality dc.b 2 ; 0=draft, 1=NQL , 2=default
PrintMark dc.b %1010 ; 1= Italics, 2= Bold, 4= Underline, 8=Colour
DriveName dc.b "DF1:",0
dc.b 0
; default prefernces
DPrefs dc.w $000,$eee,$775,$313,$04d,$997,$4b9,$553
dc.b 0
dc.b "?"
dc.b 2
dc.b %1010
dc.b "DF1:",0
dc.b 0
even
PAL
HEX_X dc.l 24 ; basic datas for PAL Amigas
HEX_Y dc.l 11+14+3+6 ; X and Y position of Hex
ASC_X dc.l (32+1+7)*8+22
ASC_Y dc.l 11+14+3+6 ; X and Y position of ASCII
BaseLine dc.l 6 ; Baseline of font
Bytes_Per_Row dc.l 16 ; Bytes per row
Zeilen dc.l 32 ; number of lines
FONT_X dc.l 8 ; X size of font
FONT_Y dc.l 7 ; Y size of font
HEX_Breite dc.l 35 ; number of characters per Hex row (plus spaces)
ASC_Breite dc.l 16 ; " " " " ASCII "
PAL_end
NTSC ; basic datas for NTSC Amigas
.HEX_X dc.l 5
.HEX_Y dc.l 11+14+3+7
.ASC_X dc.l 328+5
.ASC_Y dc.l 11+14+3+7
.BaseLine dc.l 7
.Bytes_Per_Row dc.l 24
.Zeilen dc.l 22
.FONT_X dc.l 6
.FONT_Y dc.l 8
.HEX_Breite dc.l 53
.ASC_Breite dc.l 24
Section "NP",BSS
NamenPuffer ds.b 38*300
SearchColors ds.b 1024
SearchPuffer ds.b 1024
SearchPufferII ds.b 1024
CompPuffer ds.b 100
even